Fist of Senn

a developer's notebook

Emacs and Java - Journey of a Hard Friendship

The story begins back in 2009 when I did mostly Java J2EE work. At the time I was working with windows, used a Mac at home and occasionally played around with Linux. The result was, different tools, key bindings and workflows for every platform.

I used Emacs before but because I did a lot of Java work I never got around to using it full-time. Emacs works on every platform, has a completely independent key-binding layout and with some tweaks to my configuration I got it working on every platform successfully. I quickly begun to adjust my configuration strongly and developed a personal workflow. The only gap was Eclipse to do Java. I was determined to use Emacs for my Java development.

The EmacsWiki referred me to jdee after spending hours configuring it, the result was not appealing at all. While browsing Google for better alternatives I stumbled upon a vim plugin called eclim. This project allows you to start a headless Eclipse instance and defines a protocol that the vim plugin uses to access the power of Eclipse. Disappointed to see such an amazing tool for vim but nothing close to it for Emacs I decided to start emacs-eclim.

enter emacs-eclim

The goal of emacs-eclim is to bring the functionality of Eclipse to your favorite Editor. It uses the protocol provided by eclim to communicate with your Eclipse instance. Initially I put a lot of effort into emacs-eclim to support the most common tasks. Today emacs-eclim supports:

  • managing projects
  • code completion
  • Ant
  • Maven
  • display compilation errors and problems
  • Java
    • browsing types and class hierarchies
    • refactoring to rename a symbol
    • organizing imports
    • javadoc comments

Of course emacs-eclim can not replace your IDE at the moment. It’s primary target is to make the core features of Eclipse accessible inside Emacs.

Installing emacs-eclim

The installation process is simple, just follow these steps (copied from the README on github)

  1. download and install eclim.
  2. download emacs-eclim
  3. add the following code to your emacs startup script
1
2
3
4
5
6
7
(add-to-list 'load-path (expand-file-name "/path/to/emacs-eclim/"))
;; only add the vendor path when you want to use the libraries provided with emacs-eclim
(add-to-list 'load-path (expand-file-name "~/coding/git/emacs-eclim/vendor"))
(require 'eclim)

(setq eclim-auto-save t)
(global-eclim-mode)

the breakup and a new beginning

I’ve since transitioned from Java to Ruby. This also meant, that I buried my ambitions to make emacs-eclim the standard to develop Java inside Emacs. The project was still young and not many people knew about it. Luckily a motivated and interested Swede named Fredrik Appelberg turned up and helped to keep the project alive. He put a lot of effort into emacs-eclim and helped to reduce the bugs and bring new features in. Thanks to Fredrik the project is still active and he does a good job maintaining it.

Thank you Fredrik!

the future

The Eclim protocol has a lot more to offer and there is a lot of work to do to catch up. If you happen to be a Java developer and want to integrate Emacs in your workflow, please head over to Github and give emacs-eclim a try. You can also join the discussions on our fresh Google Group. If you also happen to know lisp and want to help improve emacs-eclim, pull-requests are very welcome!

This blog post is now offered in Spanish language thanks to Webhostinghub

Comments