SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions

JavaDevelopmentEnvironment

The Java Development Environment for Emacs (JDEE) is an integrated development environment for Emacs. It interfaces Emacs to command-line Java development tools, for instance Sun’s JDK.

As of late December 2012, posts submitted to the jdee-users mailing list are not moderator approved, let alone answered. Development is by all appearances dead. Fortunately, there are signs of development for Java in CEDET.

Project site: http://jdee.sourceforge.net/

Advisories

Features

Core

From the webpage:

JDEE Extensions and Plugins

And more.

JDEE's features explained and demonstrated

Others (not so graphical):

Link to your success stories here!

Installation notes

Emacs 24

Download CEDET 1.1 and load it in Elisp. Emacs comes with CEDET 2.0; you must load CEDET 1.1 before other packages load the version in Emacs. JDEE is not compatible with new CEDET.

You could use latest JDEE from Subversion https://jdee.svn.sourceforge.net/svnroot/jdee/trunk and wrestle with the build, or download the latest prebuilt release at http://sourceforge.net/projects/jdee/files/jdee/2.4.0.1/ . When taking the latter option, you’ll need some Elisp to prevent fatal errors:

(setq jde-check-version-flag nil)
(define-obsolete-function-alias 'make-local-hook 'ignore "21.1")
(unless (fboundp 'semantic-format-prototype-tag-java-mode)
  (defalias 'semantic-format-prototype-tag-java-mode 'semantic-format-tag-prototype-java-mode))
(require 'hippie-exp)

Use something like this to load JDEE for .java files:

(add-to-list 'load-path (format "%s/lisp" "~/.emacs.d/jdee-2.4.0.1" "Path to JDEE"))
(autoload 'jde-mode "jde" "JDE mode." t)
(setq auto-mode-alist
      (append '(("\\.java\\'" . jde-mode)) auto-mode-alist))

JDEE 2.4.0.1 was confirmed to work in the 24.2.90 pretest release.

See also: http://forums.fedoraforum.org/showthread.php?t=280711 . Note that editing jde.el and deleting jde.elc is not necessary when setting jde-check-version-flag per above.

Emacs 23

Install notes for Gnu Emacs 23. This will help you get (require ‘jde) running. No guarantee on anything else.

jde depends: cedet, elib.

(add-to-list 'load-path "/usr/share/emacs/site-lisp/cedet-common/")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/cedet-contrib/")
;;for jde
(require 'cedet)

(add-to-list 'load-path "/usr/share/emacs/site-lisp/elib/")

Then you need to edit jdel.el in lisp dir.

Remove or comment out the following lines, because autoload is now part of emacs, and there is no jde-autoloads.el in jde src.

(require 'jde-autoload)
....
(unless 
    (and jde-xemacsp
	 (file-exists-p 
	  (expand-file-name 
	   "jde/auto-autoloads.el"
	   (jde-root))))
	 (require 'jde-autoload))

For jde itself, add these to .emacs, change the dirs to fit your install of course:

;;--------------------
;; jde

(add-to-list 'load-path "~/.emacs.d/jde-current/")
(require 'jde)
(setq jde-web-browser "firefox")
(setq jde-doc-dir "~/d/jdk-6-doc/")

I don’t know much about it myself. I guess there are more problems waiting.

How to load JDE in Emacs >=23.2 (after CEDET integration into Emacs trunk): I fear it is complex, as the CEDET inclusion changed package names but JDEE is still using the old ones (tested in branches 2.4 and trunk). For instance (require ‘semantic-ctxt) is the old name (standalone CEDET), but in the Emacs-included CEDET it should be transformed to (require ‘semantic/ctxt). Someone must update JDEE. 24.m3.2010, DanielClemente

I finally got JDE to work (mostly) with emacs 23.2. Here is what I did:

1) Download trunk source from svn. 2) Extract the source 3) ant configure 4) ant

here is my init file… There a few ‘tricks’ in here:

;; Update the Emacs load-path to include the path to
;; the JDE and its require packages. This code assumes
(add-to-list 'load-path (expand-file-name "~/Documents/elisp/jdee/lisp"))

 (setq semantic-default-submodes '(global-semantic-idle-scheduler-mode
                                      global-semanticdb-minor-mode
                                      global-semantic-idle-summary-mode
				      global-semantic-decoration-mode
				      global-semantic-highlight-func-mode
				      global-semantic-stickyfunc-mode
                                      global-semantic-mru-bookmark-mode))

(add-to-list 'load-path (expand-file-name "~/Documents/elisp/jdibug-0.2"))
(setq semantic-load-turn-everything-on t)
(semantic-mode 1)
(require 'semantic/senator)
(require 'semantic)
(require 'semantic/ia)
(require 'semantic/wisent)
(require 'semantic/wisent/java-tags)

;; Use the full Java 1.5 grammer to parse Java
(autoload 'wisent-java-default-setup "wisent" "Hook run to setup Semantic in 'java-mode'." nil nil)

(setq jde-auto-parse-enable nil)
(setq jde-enable-senator nil)
(load "jde-autoload")

;; load jde-testng
(require 'jde-testng)

;; load jde-maven
(require 'jde-maven2)


(require 'jdibug)

;; If you want Emacs to defer loading the JDE until you open a 
;; Java file, edit the following line
(setq defer-loading-jde nil)
;; to read:
;;
;;  (setq defer-loading-jde t)
;;

(if defer-loading-jde
    (progn
      (autoload 'jde-mode "jde" "JDE mode." t)
      (setq auto-mode-alist
	    (append
	     '(("\\.java\\'" . jde-mode))
	     auto-mode-alist)))
  (require 'jde))

(setq 
 jde-sourcepath '( "/Users/ldangelo/Development" )
 jde-db-option-connect-socket '(nil "28380")
 jde-jdk-registry (quote (
			  ("1.5" . "/System/Library/Frameworks/JavaVM.framework/Versions/1.5/")
			  ("1.6" . "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/")
			  )
			 )
 jde-jdk `("1.6")

)


;; Include the following only if you want to run
;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.
(setq shell-file-name "bash")
(setq shell-command-switch "-c")
(setq explicit-shell-file-name shell-file-name)
(setenv "SHELL" shell-file-name)
(setq explicit-sh-args '("-login" "-i"))
(if (boundp 'w32-quote-process-args)
  (setq w32-quote-process-args ?\")) ;; Include only for MS Windows.


;; Location of you emacs directory
(setq my-emacs-dir (concat (getenv "HOME") "/.emacs.d/tmp/emacs-jde"))

;; save all the semantic.cache files to one place
(when (locate-library "semantic")
  (let ((semcach (concat my-emacs-dir "/semantic-cache")))
    (unless (file-directory-p semcach)
      (make-directory semcach))
    (setq semanticdb-default-save-directory semcach)))

(define-key jde-mode-map [f8]   'jdibug-step-over) 
(define-key jde-mode-map [M-f8] 'jdibug-step-into) 
(define-key jde-mode-map [f7]   'jdibug-step-out) 
(define-key jde-mode-map [M-f7] 'jdibug-resume)

(require 'flymake)

(defun skip-cleanup())

;; function does not exist in emacs 23.2
(defun semantic-parse())

(defun flymake-java-ecj-init ()
  (let* ((temp-file   (flymake-init-create-temp-buffer-copy
                       'jde-ecj-create-temp-file))
         (local-file  (file-relative-name
                       temp-file
                       (file-name-directory buffer-file-name))))
    ;; Change your ecj.jar location here
    (list "java" (list "-jar" "/Users/ldangelo/Development/ecj.jar" "-Xemacs" "-d" "/dev/null"
                       "-source" "1.5" "-target" "1.5" "-proceedOnError"
                       "-classpath"
                       (jde-build-classpath jde-global-classpath) local-file))))
 
(defun flymake-java-ecj-cleanup ()
  "Cleanup after `flymake-java-ecj-init' -- delete temp file and dirs."
  (flymake-safe-delete-file flymake-temp-source-file-name)
  (when flymake-temp-source-file-name
    (flymake-safe-delete-directory (file-name-directory flymake-temp-source-file-name))))

(defun jde-ecj-create-temp-file (file-name prefix)
  "Create the file FILE-NAME in a unique directory in the temp directory."
  (file-truename (expand-file-name (file-name-nondirectory file-name)
                                   (expand-file-name  (int-to-string (random)) (flymake-get-temp-dir)))))
 
(push '(".+\\.java$" flymake-java-ecj-init flymake-java-ecj-cleanup) flymake-allowed-file-name-masks)
 
(push '("\\(.*?\\):\\([0-9]+\\): error: \\(.*?\\)\n" 1 2 nil 2 3 (6 compilation-error-face)) compilation-error-regexp-alist)
 
(push '("\\(.*?\\):\\([0-9]+\\): warning: \\(.*?\\)\n" 1 2 nil 1 3 (6 compilation-warning-face)) compilation-error-regexp-alist)

;; Sets the basic indentation for Java source files
;; to two spaces.
(defun my-jde-mode-hook ()
  "Hook for running java file..."
  (message " Loading my-jde-mode-hook...")
  (c-set-offset 'substatement-open 0)
  (c-set-offset 'statement-case-open 0)
  (c-set-offset 'case-label '+)
 (wisent-java-default-setup)
 (flymake-mode)
  (setq 
   indent-tabs-mode nil
   tab-width 4
   c-basic-offset 2
   tempo-interactive t
   ))

(add-hook 'jde-mode-hook 'my-jde-mode-hook)

Distributions

Note from 2004: If you use the Debian Sid jde package with CVS Emacs, you may need to apply this patch.

JDEE compared with other IDEs

Frequently Given Answers (FGA)

Did you install it correctly as documented? The website says: “Nearly all the JDEE problems that I have seen are caused by faulty setups,” and “Most problems reported by users are installation/setup problems.” See the Trouble Shooting Guide (Dead link).

Alternatives

malabar-mode

malabar-mode is an effort to create a better Java mode for Emacs.

Eclim

Eclim uses Eclipse as a backend to provide intelligent Java completion and coding support in Emacs

Comments

I’m happy to see that somebody is investigating the current status of JDE! Thanks, DanielClemente. – AlexSchroeder

JDEE development continues (slowly) on the trunk of the sourceforge repository (http://jdee.svn.sourceforge.net/viewvc/jdee/trunk/jdee/), you are more likely to find something that works with current emacs there. Please submit patches to the sourceforge jdee mailing list to help move things forward. – LenTrigg?

Stupid Question Time Really, I am not as helpless as this message is going to make me sound. I just upgraded to 23.1.50.1 (Ubuntu 9.4 incase that makes any difference) and have been beating my head against getting JDEE to install. I have CEDET 1.0pre7 (from cvs), elib 1.0 (built on the local system with 23), and I even got ecb to work (2.41 (or 2.40…the internal version numbers are not consistent with the messages) from cvs) by commenting out the jde.

I got the svn of jdee and put version 2.40 in the load path and went to town. Sort of.

So, what is the problem? When processing efc.el (eieio foundation classes), the byte-compiling of the definition of efc-coll-add craps out. The error is all about wrong number of arguments and includes three lines of character codes. By looking at the backtrace it appears that the problem is in processing the string passed to error. That is,

(error "Tried to add an item of type %s to a list of items of type %s" (typep item) (oref this elem-type))

is being processed. When the (typep item) is passed to byte-optimize-form (and on down to byte-optimize-form-walker and compiler-macroexpand) things go badly awry. I have not hacked elisp for many a moon so I am lost, lost, lost. Any hints would be greatly appreciated. It took me most of a day to get this much information and I don’t have a lot of time to go deeper, though I really want jdee to work with 23. – drbcladd

The problem seems to be a typo, looks like whoever wrote that error message intended to write

(type-of item)

, not

(typep item)

. The former would naturally fit the error’s description and would, in fact require only one parameter (typep requires two). This said, it complied for me with the above fix. – wvxvw


CategoryProgrammerUtils CategoryModes CategoryProject CategoryJava