[英]How can I configure jdee `find-class-source-file` to work with Cassandra source tree?
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. 我正在尝试为即将开始的Java项目设置Emacs + JDEE,但是我无法让JDEE正常工作。 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.
我正在使用Cassandra源作为我与JDEE合作的游乐场。
I've setup a fresh Ubuntu 12.04 VM with Emacs 23.3.1 as my test environment. 我用Emacs 23.3.1设置了一个新的Ubuntu 12.04虚拟机作为我的测试环境。 I'm using
openjdk-1.6
from the default Ubuntu repository and JDEE seems to be using it. 我在默认的Ubuntu存储库中使用
openjdk-1.6
,JDEE似乎正在使用它。 I downloaded the jdee tar ball and extracted it into ~/.emacs.d
. 我下载了jdee tar球并将其解压缩到
~/.emacs.d
。 The Cassandra source tree is checkout into ~/cassandra
. Cassandra源代码树结帐到
~/cassandra
。 My ~/.emacs.d/init.el
consists of the following: 我的
~/.emacs.d/init.el
包含以下内容:
(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
. 当我打开
~/cassandra/src/java/org/apache/cassandra/db/ColumnFamily.java
我希望能够跳转到类org.apache.cassandra.config.CFMetaData
。 When I run jde-open-class-at-point
on that class name I get the following error: 当我在该类名上运行
jde-open-class-at-point
时,我收到以下错误:
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? 我需要做些什么才能让JDEE找到源文件?
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. 我不确定到底有什么问题,但根据文档,
jde-open-class-at-point
首先在jde-sourcepath
搜索源文件,然后在jde-global-classpath
,然后在$CLASSPATH
在当前目录中。 So maybe you need to set these varables. 所以也许你需要设置这些变量。
And I post my jdee setting here, hope it can help: (it works well for me) 我在这里发布我的jdee设置,希望它可以帮助:(它适用于我)
.emacs 的.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
:
prj.el 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))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.