Skip to Content

Posts Tagged ‘emacs’

Java Without the IDE?

Permalink

Duke the Java Mascot
Today I stayed home but wanted to do some work on the Registry. However, I don’t have a workstation at home with the specs to run IntelliJ with any reasonable speed. Furthermore, I was hoping that dumping the ultra slick IDE will help me learn a bit more about the Java environment.

Eclipse Integration in Vim (Eclim) was the first promising lead I found. However, I had a tough time getting the Registry to run properly under Eclipse and Eclipse is as resource hungry to run as IntelliJ.

I couldn’t turn up any other good Vim tools so I started searching for Emacs tools. Although I am not a huge fan of Emacs I was very impressed with the SLIME environment when I did my towers of hanoi assignment in LISP. And it turned out a very slick Java environment for Emacs is available tool

A quick search for emacs java lead me to the Java Development Environment for Emacs (JDE) which offered a reasonable level of integration including:

  • Debugger Integration
  • Syntax Higlighting
  • Ant Integration
  • Code Templates

JDE Emacs with the Registry

However, it was a beast to configure. My primary problem was that the Debian jde packages in unstable are broken. After uninstalling this package and doing a manual install I had JDE running like a champ.

JDE Emacs with the Registry

The next task was to write a prj.el that would contain all of the information for JDE including: source location, classpath, default file headers, and build configuration. With some help from an example prj.el I wrote one for use with the Registry (here). Although, this file looks daunting the IntelliJ project files are unreadable by comparison.

This screenshot shows Emacs and JDE after an unsuccesful compile of the Registry. Clicking on the ant error loaded the proper file making it quite clear that I had an unfinished line.

Another standard IDE feature that JDE supports is method completion using the compact keystroke [sic] C-c C-v C-.. This brings up a dialog that lists all methods that can be called on this object.

After some digging it turns out debugging the application while it is running in Tomcat is a straightforward affair also. After deploying the application into the $TOMCAT_HOME/webapps directory running $TOMCAT_HOME/bin/catalina.sh jpda start starts Tomcat with remote debugging via JPDA on port 8000. Because the prj.el I wrote has this port set in jde-db-option-connect-socket using the menu Jdb->External Process->Attach via socket enables the debugger. Using this mode common debugging tools such as breakpoints and variable inspection are available.

Overall I am very impressed and excited to start using JDE. Only one thing is holding me up: JSP debugging. Anyone have a solution?