Here I'm keeping notes on how I get going with Eclipse.
As of July 2008, I have given up on Eclipse. Each release seems more unstable than the last, and I've gotten tired of finding new ways to stop it from crashing.
Here are my notes on Netbeans: [ Using_Netbeans_with_an_existing_project.html ]
Netbeans is much easier to set up, and it is quite intuitive to a former Eclipse user. It is also pure Java, without the native code bugs of SWT.
If you can afford it, IDEA is even better: [ Idea_notes.html ]
My project is under CVS control, with an ant build.xml, and a directory tree like the following. Let's call my project "foo".
. |-- build | |-- cls | | `-- com | | `-- acme | | `-- foo | |-- javadoc | `-- obj |-- data |-- dist | |-- bin | |-- doc | `-- lib |-- doc |-- etc |-- jar |-- src | |-- com | | `-- acme | | `-- foo | |-- cpp | `-- scripts `-- test
src directory contains all source
code for compilation. Everything is under
source control. No files created by the
build should go in here.
directories are created dynamically by the
ant build and are not in the CVS repository.
Classes, javadocs, and compiled C++ objects
are compiled into the
Jars and C++ shared-object archives are
created in the
dist directory. The
dist directory looks exactly like what
goes on a release CD. It has everything of
interest to a client. The unit tests (JUnit)
run inside the
test directory and use
only files inside the
Test log files are also formatted into the
test directory. An
ant clean simply
removes these three directories.
The remaining directories are under CVS
control and do not change during a build.
Some of each may be copied to the
directory for release.
third-party jar files only, not those created
by the build.
doc contains human-edited
documentation (not javadocs). The build may
do some formatting of these for distribution.
etc contains runtime configuration files,
such as logging properties. The
directory contains small datasets for running
First of all, I got the latest milestone build from http://eclipse.org/downloads/index.php with support for Java 1.6. Their last few releases have been great improvements. I've heard of no problems with milestone builds.
I download the linux zip file with the letters "SDK" and "gtk" in the name.
I unzip the distribution in a convenient
create an alias.
alias ecl="eclipse -data $HOME/projects -vmargs -Xmx700m -XX:MaxPermSize=256m"
-data argument sets the base directory for all projects to
a convenient location.
I was warned to increase the VM memory because it is very difficult to clean up after an out-of-memory crash.
The MaxPermSize seems to prevent another common variety of crash: http://www.eclipsezone.com/eclipse/forums/t77021.html This obscure JVM parameter defaults to too small a value. Recent releases of Eclipse are understood to fix this problem.
I also set JAVA_HOME to point to my JDK installation. Eclipse seems to use this to set paths.
build/clsdirectory with the expected hierarchy of class files. Unfortunately all other non-java files under
srcwere simply copied verbatim.
We must now change these assumptions.
jarsubdirectory. Hit "OK" twice to return to the "Libraries" tabbed pane. Hit the "Add Variable" button, select the named jars, and they should appear on the list of libraries. Hit "OK" again. The build should start again.
Some standard extensions may not be resolved even though command-line compilation would not have a problem. For the javax.jnlp package , add $JAVA_HOME/jre/lib/javaws.jar as an external jar.
Potential programming problems
The rest of the Ignores are changed to Warnings.
I check all boxes along the way.
[X] Process Javadoc comments. Malformed Javadoc comments: [Warning] Only consider members as visible as: [Private] [X] Validate tag arguments (@param...) [X] Report non visible references. [X] Report deprecated references. Missing tag descriptions: Validate all standard tags Missing Javadoc tags: [Warning] Only consider members as visible as: [Protected] [X] Check overriding and implementing methods Missing Javadoc comments: [Warning] Only consider members as visible as: [Protected] [ ] Check overriding and implementing methods
Do NOT check the final box. It would require the bad practice of overriding inherited javadocs
On the "Indentation" tab, I set "Tab policy" to "Spaces only" and indentation and tab size to 2.
On the "Braces" tab, I leave everything on the default "Same line."
I accept defaults for the "White Space" tab.
On the "Blank Lines" tab, I set 0 "Before field declarations."
On the "New Lines" tab, under "Insert new line", I check "at end of file."
I accept defaults for the "Control Statements" tab.
On the "Line Wrapping", and "Comments" tab, I set "Maximum line width" to 72.
On the "Comments" tab, I check all boxes except for the "New line after @param tags." I add checks for "Format header comment" and "Clear blank lines in comments."
After closing this panel, you will select a name for the profile. Later you can return and edit this selected profile at "Window" -> "Preferences" -> "Java" -> "Code Style" -> "Formatter".
The single most useful hotkey is probably F3, to get the declaration of a variable.
Here are some more
I've been very happy with the Vrapper plugin for vi editing mode.
Go to Help -> Install New Software -> Work with: http://vrapper.sourceforge.net/update-site/stable then check the box next to Vrapper and Next and Finish.
You'll need to restart all of Eclipse, not just the Perspective.
One installed correctly, you should see a new toolbar option Edit -> Toggle Vrapper.
To continue to get updates, Go to the menu bar (Window -> Preferences -> Install/Update -> Available Software Sites -> Add ...) and add the Location http://vrapper.sourceforge.net/update-site/stable, if it is not already present.
Bill Harlan, 2004-2006
Return to parent directory.