Search & Win   click me  


  


Installing and Configuring IntelliJ IDEA - (Version 3.0.5)

by Jeff Hunter, Sr. Database Administrator


Introduction

This document provides the steps necessary for installing and configuring IntelliJ IDEA (Version 3.0.5) for use with Java development.

IntelliJ IDEA is an award-winning Java IDA and just one of the products within the IntelliJ product line from the company JetBrains, Inc.

Downloading IntelliJ IDEA
The latest version of IntelliJ IDEA, (Version 3.0.5 v2 at the time of this writing), can be downloaded from the following URL:

http://www.intellij.com/download

Installing IntelliJ IDEA
Installing IntelliJ IDEA is as simple as answering a few screens in their wizard based install.

At the time of this writing, this document does not provide the step-by-step details (or screenshots) for installing the IntelliJ IDEA product.

Configuring IntelliJ IDEA for Java Development
This section of the document provides information and details in configuring IDEA for use with an example application called WebDBA.

Providing Username and Password

After installing and starting the IDE for the first time, you will be prompted to include a username and password. The username and password will be provided by JetBrains, Inc.
Starting a New IntelliJ IDEA Project
After successfully registering IntelliJ IDEA (which is nothing more than more than providing the correct username and password), you will be presented with a "New Project Wizard" dialog box. Use this dialog box to create the WebDBA project. The following table describes some of the values that could be used for creating the WebDBA project:

Screen 1
Name: WebDBA
Location: C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\WebDBA.ipr
Target JDK: Use the ellipse button [...] to open the "Select JDK" dialog.

Then hit the [Configure] button to open the "Configure JDKs" dialog window.

On the left pane of this dialog, click the "(+)" button, and then navigate to the location of your J2SE installation. (i.e. C:\j2sdk1.4.1). After selecting the proper J2SE home location, the dialog will automatically fill in all other relevant information for configuring the JDK for use in IntelliJ IDEA. (e.g. Class Path, Source Path, JavaDoc API Paths). Hit [OK] on the "Configure JDKs" dialog window.

You will then be returned to the "Select JDK" dialog window. Select your newly created JDK (i.e. java version "1.4.1_02") and hit the [OK] button.

Compiler output
path:
Use the ellipse button [...] to open the "Select Path" dialog.

Navigate to your output directory (I like to call it the debug directory):

(i.e. C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\debug)

Screen 2
Project Path: C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA

It is recommended that the Project Path is set to top level directory in order to make such things as Find in Path -> Whole Project work properly, if you have several source paths, they must be also located under a project path.

The Project Path should be set to a directory where the working files for your project can be found. This path will be accessible from the Project Views. Also, all operations such as search, compilation, and refactorings will be performed in these files only. It is possible to alter this path and manage additional paths in the Project Properties dialog.

Screen 3
Source Path: This dialog window should automatically include the following directories:
  C:\j2sdk1.4.1\src.zip (JDK)
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source
You may want to add several other directories and archives to this list. Use the [Add path] button to add the following directories and archives to your Source Path:
  C:\j2sdk1.4.1\src.zip (JDK)
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\JavaCC.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\ojdbc14.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\ant.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\j2ee.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\joeSNMP.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\xercesImpl.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source
Screen 4
Classpath: By default, the <Output Path> and all J2SE JDK libraries will be included in the CLASSPATH.

You may need to add additional libraries and directories required to compile and run your application.

Click the [Add path] button to add all required directories and libraries to the CLASSPATH. I provide several examples here:

  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\JavaCC.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\ojdbc14.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\ant.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\j2ee.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\joeSNMP.jar
  C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib\xercesImpl.jar

After selecting all required and optional CLASSPATH entries, click the [Finish] button.

After hitting the [Finish] dialog box to the "New Project Wizard" go off and get a cup of coffee (or two). The wizard will build and the cache database used for re-factoring, class browsing, etc.

Post Setup Steps for WebDBA Project
The "New Project Wizard" completes much of the steps required to setup and configure our WebDBA project environment. Several more steps remain, however, to fine tune our WebDBA Project. Use the IntelliJ IDEA "Project Properties" window, accessible from clicking the on the toolbar to make the following changes:

Enable "assert" keyword

Perform the following from the "Project Properties" dialog under the "Paths" settings (in the left pane). Underneath the "Target JDK Option", there is a checkbox for enabling the "assert" keyword.

Enable this option by clicking the checkbox to on.

Setting the "Exclude" Path
Perform the following from the "Project Properties" dialog under the "Paths" settings (in the left pane). Click on the "Exclude" tab. You should have your < Output > already listed. Leave this entry in place and add the following path:
C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\doc
Setting the "JavaDoc" Paths
Perform the following from the "Project Properties" dialog under the "Paths" settings (in the left pane). Click on the "JavaDoc Paths" tab and add the following path:
C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\doc\java
Compiler Options
Perform the following from the "Project Properties" dialog under the "Compiler" settings (in the left pane):

  • In the "Exclude from Compile" table, add any directories within your work are that should not be included with each compile. For any of those directories, I typically include them with the "Recursive" option checked on:
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\doc        [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\lib        [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\debug      [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\Data       [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\C++        [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\org        [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\release    [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\systest    [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\ThirdParty [x]
    C:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\tools      [x]
  • Change the Maximum heap size (Mb.) to: 172

  • By default, the "Resource patterns" text field will have the following:
    .+\.(properties|xml|html);.+\.(gif|png|jpeg|jpg)
    I sometimes need to remove this and leave the "Resource patterns" text field blank.
Post Setup Steps for IDE Settings
After configuring your project with IntelliJ IDEA, you should take some time to make overall changes to the IDE. Use the IntelliJ IDEA "IDE Settings" window, accessible from clicking the on the toolbar to make the following changes:

Editor Button

Click on the "Editor Button" and turn off both options within the "Virtual Space" section; "Allow to place caret after end of line" and "Allow to place caret inside tabs".

Next, within the "Strip Trailing Spaces on Save" section, choose the "All" option in the pull down chooser.

In the "Display" section, ensure that the "Right margin (columns)" option is enabled and set to 80.

Code Style
After clicking on the "Code Style", click on the "Indent and Braces" tab. Within the "Tab" section, ensure that the "Use Tab Character" check box is unchecked and that the "Tab size" is set to 4.



Last modified on: Saturday, 18-Sep-2010 18:02:36 EDT
Page Count: 26769