|
|
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.Downloading IntelliJ IDEAIntelliJ IDEA is an award-winning Java IDA and just one of the products within the IntelliJ product line from the company JetBrains, Inc.
The latest version of IntelliJ IDEA, (Version 3.0.5 v2 at the time of this writing), can be downloaded from the following URL:Installing IntelliJ IDEA
Installing IntelliJ IDEA is as simple as answering a few screens in their wizard based install.Configuring IntelliJ IDEA for Java DevelopmentAt the time of this writing, this document does not provide the step-by-step details (or screenshots) for installing the IntelliJ IDEA product.
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 ProjectAfter 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:Post Setup Steps for 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\SourceYou 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\SourceScreen 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.jarAfter 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.
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 thePost Setup Steps for IDE Settingson 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.Setting the "Exclude" PathEnable this option by clicking the checkbox to on.
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:Setting the "JavaDoc" PathsC:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\docPerform 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:Compiler OptionsC:\Documents and Settings\jeffreyh\IdeaProjects\WebDBA\Source\doc\javaPerform 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.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 theon 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".Code StyleNext, 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.
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.