15

There's plenty of closely related questions on SO, just to name some of them:

The difference of my questions is that I want to know how to make working with Java as easy as with Clojure right from Emacs within mixed Clojure/Java Leiningen project.

What I mean is possibility to (in order of priority):

  • compile Java code right from Emacs (note: it is possible to compile it from the shell with lein javac)
  • use code completion for Java (tools like JDEE provide this feature, but it is separate tool that doesn't concern Leiningen project setup)
  • debug Java code
Community
  • 1
  • 1
ffriend
  • 27,562
  • 13
  • 91
  • 132
  • JDEE is your best option if you really want to do the Java work in Emacs. IMO not worth it, but it's adequate. – Dave Newton Feb 19 '12 at 15:12
  • 1
    For intellient completion you can try [eclim](http://eclim.org/) which also has an emacs interface. – Tom Feb 19 '12 at 17:05

4 Answers4

1

Check out the Emacs LSP project. It provides support for Java.

Benjamin Cassidy
  • 827
  • 1
  • 8
  • 23
0

Probably not what you wanted exactly, but this should handle bullet 1 for ya:

(defun lein-javac (&optional PROJECT-DIR)
  (interactive)
  (let ((output-buffer (progn
                         (with-output-to-temp-buffer "*lein-javac*" nil )
                         (select-window (get-buffer-window "*lein-javac*"))
                         (read-only-mode 'toggle)
                         (window-buffer)) ))
   (shell-command (concat "cd " (or PROJECT-DIR default-directory) 
                         " && lein javac &") "*lein-javac*")))
l.k
  • 199
  • 8
0

I want to try auto complete but I haven't gotten to it yet.

Given the way leiningen/Clojure work anyway, I'm not sure how easy you could make compilation. When you compile Java code, don't you have to restart the repl/application for the JVM to reload it anyway?

BillRobertson42
  • 12,602
  • 4
  • 40
  • 57
  • Actually, it is possible to reload class from running Java process using custom ClassLoader (see [example](http://tutorials.jenkov.com/java-reflection/dynamic-class-loading-reloading.html)). However, I'm not switching between Java and Clojure too frequently, so it is ok for me to restart slime-clojure from time to time. – ffriend Feb 19 '12 at 23:53
0

Malabar-mode is abandonware but I think it's shooting for the level of functionality that you want. It seems to me that a coprocess-based autocompletion engine should be feasible with CEDET, leiningen, and swank-clojure, but I have a day job and side work...

Steven Huwig
  • 20,015
  • 9
  • 55
  • 79