IntelliJ : Java Glossary

The CurrCon Java Applet displays prices on this web page converted with today’s exchange rates into your local international currency, e.g. Euros, US dollars, Canadian dollars, British Pounds, Indian Rupees… CurrCon requires an up-to-date browser and Java version 1.5 or later, preferably 1.7.0_02. If you can’t see the prices in your local currency, Troubleshoot
Jetbrains Intellij Idea  IntelliJ Idea

JetBrains makes a high end IDE called IntelliJ Idea, usually called simply IntelliJ. The current version is 11.0.2 Last revised/verified: 2012-02-02.

Jetbrains gave me a copy of Personal IntelliJ on 2006-02-20. I have been using it as my only IDE (Integrated Development Environment) ever since. I still use Visual SlickEdit for quick edits since Idea takes so long to start. IntelliJ is reknowned for its advanced editing and clever algorithms for factoring code. It is written in Java Swing itself. It comes with its own JRE (Java Runtime Environment) 1.6.0_21. It does not show up in the Java control panel or the Windows control panel. You can delete it by deleting the J:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.0.1\jre\ directory tree, then IntelliJ will try to use your default JRE. IntelliJ is also known for being faster than the competition. It has to be quicker and better since its competitors like Eclipse, NetBeans and Oracle are free. This is Chris Lamb’s favourite IDE. It runs under Windows, Max OS (Operating System) X, and Linux. I like it better than Eclipse, but I have not used Eclipse in a long while, and gave up on NetBeans long ago as too slow for my elderly machine. It is hard to find someone with up-to-date experience on all three.

Pricing Downsides
Getting Started Tips
Configuring a Project and Modules With IntelliJ Backup
Hooking Up the JDK Files
Nice Stuff Annotations
Plug-Ins Yet to Learn
The Rearranger Links

Pricing

It comes in five versions:
  1. $0.00 USD for the Stripped down Community version. Free to everyone. This is the Java developer’ Core. The Ultimate edition has support for J2EE, other languages etc.
  2. $0.00 USD for Ultimate Edition for Open Source developers.
  3. $99.00 USD for the Ultimate Edition for Academic use.
  4. $249.00 USD for the Ultimate Edition for Personal use.
  5. $599.00 USD for the Ultimate Edition for Commercial use.
All but the free versions come bundled with unlimited email support. The support is fast, courteous and generous, even when you don’t have official support. This is the advantage of using a commercial package.

Getting Started

To get started on your first project, you must manually navigate on hard disk to find a JDK (Java Development Kit) for it. At first, it looks as if it is broken, showing an empty list of installed JDKs.

Like Eclipse, IntelliJ has its own vocabulary. Classes are grouped into packages. Packages are grouped into directories. Directories are grouped into modules. A module in a group of packages all compiled with a common source code level. Modules are grouped into projects. All classes in a project must use a common code style. You recompile the. project as a whole. Projects are usually more or less self contained collections of code that share code. You might carve many distributables out of a single project.

It is easy to muddle up projects, directories, modules, packages. I discovered two tricks to help sort it out.

  1. Use a naming convention, e.g. end projects in p, and modules in m.
  2. If you don’t know if some node IntelliJ is showing you is a project or a module or a directory, refactor and threaten to rename it. IntelliJ will tell you what sort of beast you are about to rename.
Unfortunately IntelliJ will ask you to create packages and modules without properly defining them. You will likely have to start from scratch once the meanings come clear. The key place to define these terms should be the screens displayed the first you are asked to name your project and module. Hint hint…

To allow one project to use the class files of another, you import not the project, or the module, but the name of the classes directory into your module settings.

You get at the module settings not with settings menu item, but by right clicking on the module name in the left panel. This also where you select which compiler and compiler settings to use.

I suggest experimenting with some small projects for a while to get the hang of things before you commit to your overall structure.

Configuring a Project and Modules With IntelliJ

Configuring a project into modules is very simple, but there are so many options is it easy to go off the rails and spend an evening pulling out your hair. Here is how I do it. I create a new project (a very rare event) lets say called mp. I create six modules within that project, that I call j1 j2 j3 j4 j5 j6. I keep the code designed to run inJava version 1.1 or later in j1, the code to run inJava version 1.2 or later in j2 etc.

I configure each module with the appropriate source code level and click apply. I configure the output directory to use the module compile output path. Then compiled classes will then be put in directories with names like J:\intellij\mp\out\production\j1\com\mindprod\bio. These output directories are intentionally not visible inside IntelliJ. when I want to explore them, I will have to use some sort of external file manager such as Windows Explorer.

I configure module j2 under module settings ⇒ dependency ⇒ add a j1 module dependency to j2 ⇒ mark it exported so that users of j2 will see j1 as well. I configure module j3 under module settings ⇒ dependency ⇒ add a j2 module dependency to j3 ⇒ mark it exported so that users of j3 will see j2 and j1 as well. I repeat for j4 j5 j6.

I now create my package structure under each module, i.e. com then mindprod then bio which creates a collapsing tree structure of packages. Then I can either create new classes or use Windows Explorer to drag Java source files into place in the tree. Clicking synchronise will make IntelliJ notice the new or updated files I placed in its source tree. I can also create new package directories with Explorer. The easiest way to handle this is to create your first packages and files with IntelliJ, look at the structure, then use Explorer to create more of the same structure.

IntelliJ stores each module configuration in an IML/XML file. Yours should look something like this:

In the bad old days, when you installed an upgrade to IntelliJ, you had to redo all your settings, reinstall your plug-ins. Now it cleverly copies this sort of information from the previous install, even the vmoptions. However, when you uninstall the old version, after you get the new one working, do not tell the uninstall to also remove settings, otherwise you will delete them for the new version too.

Hooking Up the JDK

You must tell each project in IntelliJ where your JDK is and tell each module in each project where which target version to simulate.

  1. Click File.
  2. Click Settings.
  3. Click Compiler.
  4. Click Java Compiler.
  5. Click Javac.
  6. Click OK.
  7. In the project panel, click the name of your project. This is the tricky part. You must click the project, not the module to configure the module.
  8. Click Module Settings.
  9. Click Project.
  10. Select your Project SDK (Software Development Kit). If your JDK is not listed, click new and follow your nose. You can use a 32 or 64-bit JDK. You can use one different from what IntelliJ itself is using to drive the IDE.
  11. On the left, click modules.
  12. Click the name of one of your modules from the middle column.
  13. Select the JDK version level you wish to simulate for that module.
  14. Click Dependencies
  15. Select your Module SDK. If your JDK is not listed, click new and follow your nose.
  16. Configure anything else about he module while you are here.
  17. Repeat last five steps for each module.
  18. Repeat everything for each project.

Nice Stuff

Plug-Ins

IntelliJ Plug-ins come with no installation instructions. It turns out that installing any plug-in, including the Rearranger, is a snap. You don’t have to download or build anything. In IntelliJ, Click File ⇒ Settings ⇒ IDE Setting ⇒ Plug-ins.. You can then view the plug-ins installed already and also what is available. Right click “the Rearranger” (or whatever plug-in you want to install, then left click Install. (Selecting the plug-in and hitting OK does nothing, ditto reload.). You have to shut-down and restart IntelliJ before you can start using the plug-in.

Rearranger logo  The Rearranger

The ability to order your methods is not built-in as it is in Eclipse. Instead you install a plug-in called the Rearranger that does even more: You must configure The Rearranger before use to tell it your preferred ordering. To configure, go to File ⇒ Settings ⇒ IDE Settings ⇒ Rearranger. It gives you very fine control. It is wise to save your Rearranger configuration to a file in case you have to later reinstall.

If you want to clump your String[] declaration together, you must specify the class like this: "String\[\]" since the expression is a regex, and [] have special meaning in regexes.

It is clever in the way it arranges methods, and inserts comments to label the groupings. It can put getters and setters next to the corresponding property. It knows that the main method is the primary one and should come before the other static public methods.

Here

Make sure you export and back up your Rearranger configuration.

Downsides

Tips

Backup

Other than your source files make sure you back up the project description files, the *.ipr and *.iws files. Also back up your Rearranger configuration and your codestyle configurations in C:\Users\user\.IntelliJIdea11. These files can take hours to recreate from scratch.

Restoring the codestyle is a bit round about. You must create a new dummy configuration, and save it, without the .xml extension. Then, shut down IntelliJ and overwrite that file with the one from backup. There is no menu command to restore. Make sure the internal codestyle name is also what you want.

Files

*.ipr is an XML file containing the project settings for a single project. It contains such things as code style preferences and spelling exceptions.

*.iws is an XML file containing the debugging settings for a single project. It contains such things as where the breakpoints are.

*.iml is an XML file containing the dependency settings for a single project/module. It contains the list of source code and class jars that this project code depends on.

C:\Users\user\.IntelliJ10 is a directory that contains all manner of configuration information about IntelliJ, including the codestyles description, plug-in jars relevant to all projects.

Annotations

To use annotations, e.g. @Nullable or @NotNull inside IntelliJ, you must add F:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.0.1\redist\annotations.jar as a library of annotations to the module. You might want to turn on external annotations in settings ⇒ code stile ⇒ code generation to store annotations outside the source code. I could not get annotations internal or external to work.

Yet To Learn

I need to find way to trigger the light bulb suggestions for improvement. If I don’t look at them right away, they disappear.

How to keep the Alt-F7 Usages Window from disappearing before I have finished with it. You can get in back again with the tab. It might be nice to have them in another window always visible, especially if you have a big screen.

IntelliJ has a CSS (Cascading Style Sheets) and HTML (Hypertext Markup Language) editor as well, complete with refactorings. I have not yet used it. Perhaps it will do the various cleanups I thought I would have to write custom code to do.

IntelliJ integrates with many version control programs.


CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/intellij.html J:\mindprod\jgloss\intellij.html
logofeedback Please email your feedback for publication, letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email If you want your message kept confidential, not considered for posting, please explicitly specify that.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.214]
You are visitor number 34,709.