I'm trying to get Emacs+JDEE setup for a Java project I'm about to start on, but I'm having trouble getting JDEE to work properly. The first think that I want to tackle is being able to jump to the source file of a given class name. I'm using the Cassandra source as my playground for working with JDEE.
I've setup a fresh Ubuntu 12.04 VM with Emacs 23.3.1 as my test environment. I'm using openjdk-1.6
from the default Ubuntu repository and JDEE seems to be using it. I downloaded the jdee tar ball and extracted it into ~/.emacs.d
. The Cassandra source tree is checkout into ~/cassandra
. My ~/.emacs.d/init.el
consists of the following:
(setq jde-sourcepath '("~/cassandra/src/java"))
(add-to-list 'load-path "~/.emacs.d/jdee-2.4.1/lisp")
(load "jde")
When I open ~/cassandra/src/java/org/apache/cassandra/db/ColumnFamily.java
I want to be able to jump to the class org.apache.cassandra.config.CFMetaData
. When I run jde-open-class-at-point
on that class name I get the following error:
Cannot determine the class of "CFMetaData".
Likewise if I run
(jde-find-class-source "org.apache.cassandra.config.CFMetaData")
I get this error:
jde-read-class: No match for CFMetaData
What do I need to do to get JDEE to find the source files?
I'm not sure what is wrong exactly, but according to the documents, jde-open-class-at-point
searches for the source file first in jde-sourcepath
, then in jde-global-classpath
, then in $CLASSPATH
, then in the current directory. So maybe you need to set these varables.
And I post my jdee setting here, hope it can help: (it works well for me)
.emacs
(add-to-list 'load-path "~/.emacs.d/plugins/jdee-2.4.1/lisp")
(autoload 'jde-mode "jde" "JDE mode" t)
(setq auto-mode-alist
(append '(("\\.java\\'" . jde-mode)) auto-mode-alist))
And I use prj.el
for each project:
prj.el
(jde-project-file-version "1.0")
(jde-set-variables
'(jde-jdk-registry (quote (("1.6" . "/usr/java/jdk1.7.0_51"))))
'(jde-jdk (quote ("1.6")))
'(jde-xref-db-base-directory "./xrefdb")
'(jde-xref-store-prefixes (quote ("")))
'(jde-build-function (quote jde-ant-build))
'(jde-ant-enable-find t)
'(jde-sourcepath (quote ("./src")))
'(jde-built-class-path (quote ("./bin")))
'(jde-global-classpath (quote ("./bin" "./src" "./lib")))
'(jde-electric-return-p t)
'(jde-enable-abbrev-mode t))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With