我正在尝试在 OS X 上为 emacs 24 配置JDEE。当我创建一个 .java 文件时,环境似乎是自动加载的(请参见图片),因此它似乎安装正确。但是,当我尝试使用M-x jde-complete
(我尚未将其绑定到任何键)自动完成任何内容时,我收到以下消息:
找不到 JDK 的工具 jar 文件(或等效文件)。键入 Mx describe-function [RET] jde-get-jdk-dir 了解更多信息。
我跑去/usr/libexec/java_home
找到我的 Java 主页并将其设置在我的~/.bash_profile
:
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home"
然后我将 JDEE 配置为指向 JDK ~/.emacs
:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(jde-jdk (quote ("1.7.0_17")))
'(jde-jdk-registry (quote (("1.7.0_17" . "/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home")))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
谁能告诉我为什么自动完成不起作用?我相信我设置的 JDEE 的任何部分当前都没有工作,但是,我使用自动完成来测试,因为这是我开始工作的主要优先事项。
更新:如果我使用M-x jde-compile
它说
JDE 无法识别 JDK 1.7 javac。假设 JDK 1.6 javac?(是或否)
它似乎找到了我的JDK。如果我输入 yes ,它会给出同样的错误(Cannot find JDK's tools jar file (or equivalent)
。