Building Java applications inside Emacs with JDEE

First of all, I think Eclipse is a great IDE. There are a ton of features that work really well in Eclipse: intellisense, auto-compilation, and hotswap debugging. It handles your project and classpath pretty well too… But the more I get used to Emacs the less I can stand typing in an non-Emacs setup. Eclipse even has key binding support for Emacs mode, but it’s just not the same. Plus, it occupies a tremendous amount of real-estate as seen below.

Eclipse window. I’m not a fan of the tabs, nor do I like the redundant information (package information is in three spots). Overall I think it’s a good IDE, but I think I could be more productive in Emacs. (Discounting the non-trivial setup cost…)

So I’m trying Java within Emacs with JDEE. At the moment, I can’t get it to be an Eclipse replacement and I’m not sure it supports completions like Eclipse does. But when I started typing I forgot I had auto-complete mode on! While it may not know the scope of a class, it saves a lot of time with quick tab completion of long Java variable and class names. Intellisense and auto-complete mode are two different tools, but I’m starting to think I’d rather have the auto-complete over Intellisense. Also, as I’ve been using YASnippet more and more, I can quickly add custom snippets to expand code. Eclipse does have some of this, namely a nice try / catch like snippet. But imagine being able to have that code expansion on anything you wanted… that’s YASnippet!

But to get it to work with Emacs 24, there is some annoying configuration. I found an obscure forum post that details the instructions, which seem to get JDEE up and running. After some manual project configuration by customizing some variables as outlined in the user’s guide, I was able to get my project built and running.  Yeah yeah, Eclipse automatically handles the classpath variable, I know.

Honestly, this is a lot of pain to go through and I don’t recommend it unless you are already an Emacs user. But, once one does get it finally working, I think the benefits of staying in Emacs outweigh the context switch of using Eclipse. At least for small projects. For large projects with complex dependencies and a complicated build process, I’m not sure about JDEE, but for small projects, like this Othello game AI I’m working on, it’s fine.

My agent is the green ones. I played against my agent and beat it and I was like “Yeah!!!” But then, I realized that just means my AI isn’t that good yet…

So this weekend I’ll be improving my Othello AI and studying for my AI midterm.  (All things I should be doing instead of trying to get Emacs to work well with Java… 🙂 )

The same code as seen through Emacs. Much more code centric without a lot of the extra noise…

3 thoughts on “Building Java applications inside Emacs with JDEE

  1. I’m starting to really hate Eclipse. It uses up a ton of memory and crashes on me all the time in Ubuntu. I started using Intellij and it’s much better. I like it a lot more.

  2. Yeah, it’s still definitely very IDE-y. You do have a pay for a license if you want full support for languages outside of Java. Or you can try to go to random meet ups and hope they give them out for free 🙂
    That’s how my co-worker got his.

Comments are closed.