Brian Ray's Blog : Elk/JavaIDEChoices.html

Painting is just another way of keeping a diary. --Picasso

Mon, 29 Aug 2005

JAVA tomcat IDE choices

Elk is written in JAVA, deployed under Tomcat. I am currently looking for the best development environment for this project.

X11 / VIM / Screen / jdb

I use my favorite bare-bones combination of VIM with GNU Screen. Yes, I am from the vi School. I run tomcat and jdb in the other screens.

Here is a screen capture of the complete

http://brianray.chipy.org/images/GNU_screen.png

From tomcat I start with a script:

#!/bin/sh

export JPDA_ADDRESS=8000
export JPDA_TRANSPORT=dt_socket
export JAVA_HOME=/usr

/usr/local/jakarta-tomcat/bin/catalina.sh jpda start

Java Platform Debugger Architecture (JPDA) allows me to debug in this configuration and in others.

From VIM, I reload from the base directory and simply call:

:!ant reload

For the debugger, I run JDB:

$ jdb -attach 8000

This allows me to interactively debug the Tomcat session with breakpoints, stepping, and catching exceptions. It's a little tedious because to set a break point I need to type "stop at MyClass:100" or "stop in org.cip4.elk.ElkEvent.getTimestamp" to stop in a particular method.

Eclipse

My next attempt was to use the well known editor (particularly well know in the JAVA crowd), Eclipse. While this is a huge project and I understand the appeal, I had lots of problems with this approach.

My workstation for this project is a 667 MHz G4 PowerBook with 512MB ram. It's a decent machine but does not handle Eclipse. Besides Eclipse the only other programs I have had any slowness in are high intensity games. I have no clue why Eclipse eats so much of my RAM and CPU, but its a hog. I blame JAVA.

Beyond this, the environment while spectacular, does not look at all native to my OS. However, options are so plentiful it takes me hours to figure out how to make some small modifications.

Eventually, I was able to debug Elk in Eclipse. The debugger experience some memory thrashing and could not step into every function. The real value was in the junit and javadoc (move javadocs) integration.

Xcode

The third and finally environment is one which shipped with my OS, xcode. I am quite impressed with xcode in all areas. In particular, I enjoy working on native applications in C and C++ via Apples Carbon API and writing some Python, as well. Xcode is great, give it try. Because Apple seems to also embraces JAVA, it's not a bad fit for pure JAVA development with Tomcat.

I found Tim Fanelli's Blog Entry entry quite helpful. Based off Tim's advice, here is what I did to get Tomcat working and debugging in xcode:

  1. checked out the Elk sources (full instructions)

  2. In xcode, created a new empty project with the same directly the sources were checked out. Name the project with the same name used as the module, this case, "ELk". NOTE: the .xcodeproj file should end up in the same directory as your build.xml file. This is also a good time to set up Source Control Management (SCM). I add CVS , but note xcode also support our friends over at Subversion.

  3. From the finder, dragged the src/ directory into the "Elk" item in the project window.

  4. Removed any unwanted items from the folder hierarchy now in xcode. For example. removed all the .jar files.

  5. Project -> New Target. Chose 'Shell Script Target'.

  6. In the new Target, double clicked on "Run Script". Under the "General" tab, entered, "/usr/bin/ant;"

  7. Project -> New Build Phase -> New Copy Files Build Phase

  8. Control + Click "Copy Files" (or right click if you have Mighty Mouse)

  9. Add "Empty File in Project". Choose the dist/ directory. Create a file matching the output from your Ant build. Mine is called "elk.war".

  10. Double click on the "Copy Files" phase. Type the absolute path to your tomcat deployment directory. Mine "/usr/local/jakarta-tomcat/webapps/".

  11. Project -> New Custom Executable. Enter "Tomcat" and make the path "/usr/bin/java".

  12. Select the Arguments Tab enter:

    -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/commons-logging-api.jar
    -Dcatalina.home=/opt/tomcat
    -Xmx128m
    -Xms64m
    -Xincgc
    -Djava.awt.headless=true
    org.apache.catalina.startup.Bootstrap -debug start
    

Under the Debugging tab, choose "Java Debugger".

Java's Best Development Environment

Between the three choices above, I still am unsure which direction I will go. There are pros and cons of each. I am interested to hear what other tips and tricks people haves.