JetBrains makes a high end IDE
called IntelliJ Idea,
usually called simply Intellij. The current version is 8.1.3
Last revised/verified: 2009-06-17.
Jetbrains gave me a copy of Personal Intellij on 2006-02-20.
I have been using it as my only IDE 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 1.6.0_10.
It does not show up in the Java control panel. It 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. Has no GUI wizards though they are in
beta. This is Chris Lamb’s favourite IDE. It runs under Windows, Max OS X,
and Linux.
Pricing
It comes in four versions:
-
for Open
Source developers.
-
for Academic
use.
-
for Personal
use.
-
for Commercial
use.
I believe the products themselves are identical. All but the free version come
bundled with unlimited email support. The support is fast, courteous and
generous. 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 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 roughly
corresponds to one distributable executable. Each module can have its own
classpaths and libraries. Modules are grouped into projects.
All classes in a project must use a common code style, and common source level
1.3, 1.4, or 1.5 (oddly specified on the module configuration screen) and common
target level (specified as additional compiler options -target
1.4.) It is possible, however, for each module to use a different JVM.
To simplify things, you can have only one module per project. Then a project
becomes a group of related packages all compiled at the same source and target
level.
It is easy to muddle up projects, directories, modules, packages. I discovered
two tricks to help sort it out.
- Use a naming convention, e. g. end projects in p, and modules in m.
- 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.
Nice Stuff
- Like Eclipse, it instantly warns you of syntax errors as you type. They
disappear as soon as you fix the problem. You don’t need to invoke the
compiler to check out your corrections.
- The error messages are more intelligible than Eclipse’s.
- It warns you when override a method in the superclass with a tiny red arrow in
the margin, with a tooltip to explain what it means.
- It is quite easy to find things. Menus and dialogs go more or less directly to
what you want. Even on my first time out I did not get lost wandering around a
rabbit warren of nested dialogs. It is quick and easy to find thing in help. For
example, you click the wrench icon, and then laid out before are all icons for
all the different things you could possibly configure. You go right to what you
want, rather than playing rabbit in the warren of nested menus trying to find it.
- It has a built-in lint they call code
analysis.
- It is very similar to Eclipse. I had very little problem adjusting to the
differences.
- If IntelliJ were a person, you might describe it is polite, considerate or
thoughtful. It is sort of like the lady in a hotel who puts a little chocolate
on your pillow. There are considerate little touches, like telling you in the
default code templates where to look to modify them, rather than making you go
digging. Like the gracious Mrs. Prothero in Dylan Thomas’s A child’s
Christmas in Wales, IntelliJ offers you something interesting to read
while it is compiling.
- Back in the 70s IBM used to give away folding cardboard cheatsheets. The green
card, the blue card or the pink card neatly summarized all the information you
often had to look up in manuals. IntelliJ carries on this fine tradition
offering a PDF file that when you print it, turns into a folding cheat sheet
that shows all the keyboard short cuts. It is one sided. Perhaps there is a
backside for it.
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.
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:
- rearranges (reorders) class and class member declarations according to a user-specified
order and/or method call hierarchy;
- generates section-marking comments
- provides several controls for spacing within and between methods and classes.
- permits the user to manually rearrange items. This is particularly useful for
related groups of constants or to manage initialisation order.
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.
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 is the rearranger configuration I use.
Downsides
- IntelliJ is even slower than Eclipse’s 38 seconds to get started. You will
want leave it running. On my old 512K machine, it took 87 seconds to start up
before I could enter a keystroke. Even with my new 3 gig dual core machine, it
takes 13 seconds to get started. Older versions took an annoying 14 seconds to
shut down, but now it shuts shout down instantly. For a Win2K or XP machine you
need a gig of RAM, for Vista 2 gigs.
- IntelliJ is less jittery about temporary errors in code, such as something not
defined yet, or is unused — it just changes colour. However, IntelliJ
annoys you by asking if you want to import anything it does not recognise. In
Eclipse, syntax errors generate a giant slew of messages, making it hard to deal
with anything else.
- It does not summarise your errors at the bottom of the screen the way Eclipse’s
problems panel does. At least it doesn’t by
default. You have to go looking for the little syntax error markings. I find
them easy to overlook and thus don’t find out about my errors until a full
compile. F2/Shift-F2 help you find them within a
file fairly easily.
- Though it sometimes underlines errors in Javadoc, it does not pester you about
fixing them the way Eclipse does. I find it easy to overlook the errors. They
don’t count as compile errors or warnings. I don’t get them cleaned
up until an Inspector pass.
- If there are files in the library for a project that don’t belong, and you
delete them, it literally deletes the files. It does not simply remove them from
the project.
- If you want to access files you compiled outside IntelliJ, it is best to bundle
them up into jars and include the jars individually rather than try to provide a
classpath. If you use a classpath, you will either end up including far more
than you intended, or it will claim not be to able to see the directories you
did import.
- When you are working in Eclipse you are always aware instantly of the global
effect of your every keystroke. In IntelliJ, you focus on one class at a time.
You can only see one project at a time, and when you swap projects IntelliJ
frantically rescans the source. There is no equivalent of the workspace, a
collection of classes from various projects that you are working on right now in
concert, other than a set of windows you have open.
- When you run the code inspector (lint), it often display the results from some
previous run. It saves old runs, something that is just confusing.
- Sometimes the message from a successful compilation gets lost. All works, but it
does not acknowledge.
- If you reconfigure which JDK to use for a project, IntelliJ hums away for what
seems an eternity. It is reindexing all the class files in all the jars and also
all the source code in the JDK. Just let it churn.
- You have very detailed ability to define your code formatting style. With a
single click you can pull an entire project into conformance. However, when you
save a configuration, it does not show up in C:\Users\user\.IntelliJIdea80\config\codestyles
until you exit IntelliJ. It requires you to have changed something in the
configuration before it will save it. Further it fails to save unless you run
IntelliJ as an administrator. It is not enough to just log-on as administrator.
You must configure the icon to launch IntelliJ with run as administrator.
To restore, you must put the xml config file in C:\Users\ user\.IntelliJIdea80\config\codestyles.
You can’t load it from some other directory. Just to confuse you, the name
of the configuration is not necessarily the same as the name of the file. It is
emedded in the XML in <code_scheme name="xxx">.
There are both .IntelliJIdea80 and .IntelliJIdea8x
directories. You need them both.
- If you try to debug a class not in the current project, it gives no error
message, just terminates immediately.
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\.IntelliJIdea80. These files can take hours to recreate
from scratch. You don’t need to back up C:\Users\user\.IntelliJIdea8x.
Restoring the codestyle is a bit round about. You must create a new dummy
configuration, and save it, without the .xml extenstion.
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.
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 and HTML 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 progams. I want to start using
Subversion for all my projects.