JDEEand Emacs

I use Eclipse for my daily Java Coding.  It’s nice — it takes a lot of the stupid Java crap away from you and does it for you.  Or, at the very least, offer you it’s help in that regard.

This week I’ve been using our corporate-approved BPM solution.  It supports putting Java code into it (in which I call our real logic).  But their editor is, uh, lacking.  The only thing that makes it better than Notepad is that it has syntax coloring. But I’m not even sure it’s better than Notepad.

Luckily, you can specify your own editor and, if you know me, that editor is Emacs.  It was simple to point it to “gnuclient” so a new Java file will open up in my same Emacs window.

Emacs doesn’t have some of the nice features Eclipse has, like auto-assist, code templates, etc. Oh wait! It can!  It’s called JDEE and setting it up is not for the faint of heart, but worth the effort.

To start with, I’d use the install script — that will automate the downloading, unzipping, and byte-compiling.

There isn’t any real directions on what you should put in your ~/.emacs file.  This is what I found worked:



(load-file (expand-file-name “~/emacs/cedet/common/cedet.el”))
(add-to-list ‘load-path (expand-file-name “~/emacs/cedet/common”))
(add-to-list ‘load-path (expand-file-name “~/emacs/cedet/semantic”))
(add-to-list ‘load-path (expand-file-name “~/emacs/cedet/speedbar”))
(add-to-list ‘load-path (expand-file-name “~/emacs/elib”))
(add-to-list ‘load-path (expand-file-name “~/emacs/cedet/eieio”))
(add-to-list ‘load-path (expand-file-name “~/emacs/jde/lisp”))
(require ‘jde)
Then you have to customize stuff.  Since this project is the only one I’m going to edit in Emacs, I added all the dependent jars in the Global Classpath.

It starts up when you load a Java file — or, as I did, hit the “Edit” button.

Most of the commands have the weird prefix of ‘C-c C-v”.  “C-c C-v .” tried to autocomplete the method call you are on.  “C-c C-v C-z” imports the object type your cursor is currently on.  It uses Beanshell on the backend but, really, you don’t have to worry about it — it just works.

So, does JDEE replace Eclipse?  Hardly.  The install is hard, the configuration is intense, and heck, it’s not Eclipse.  But this setup is  still useful when you are forced into an environment without your favorite IDE.




Powered by ScribeFire.

Leave a Reply

You must be logged in to post a comment.