准备文件:
1) GNU Emacs24 http://www.gnu.org/software/emacs/
2) Java Development Kit (JDK) http://www.oracle.com/technetwork/java/index.html
3) Java Development Environment for Emacs (JDEE) http://jdee.sourceforge.net/install.html
4) ELIB http://en.sourceforge.jp/projects/sfnet_jdee/downloads/jdee/Dependencies/elib-1.0.zip/
5) CEDET http://sourceforge.net/projects/cedet/files/
6) ECB http://sourceforge.net/projects/ecb/files/
设置步骤:
1) 安装Emacs
2) 安装JDK到任意路径 c:\program file\Java\jdk1.7.0_67
3) 解压JDEE,ELIB, CEDET, ECB到任意路径:
C:\program file\Java\ jdee-2.4.1
C:\program file\Java\elib-1.0
C:\program file\Java\cedet-1.1
C:\program file\Java\ecb-2.40
4) 运行Emacs,输入c-xc-f,打开设置文档.emacs,如果不知道设置文档在哪里,选定Options->Highlight Active Region -> Save Options,可以看到下方信息栏显示:例wrote: c:\Users\Administrator\AppData\Roaming\.emacs,输入这个路径即可打开该设置文档。
5) 在.emacs输入如下代码并保存:
(setq jde-help-remote-file-exists-function '("beanshell"))
;; Set the debug optionto enable a backtrace when a
;; problem occurs.
(setq debug-on-error t)
;; Update the Emacs load-pathto include the path to
;; the JDE and itsrequire packages. This code assumes
;; that you haveinstalled the packages in the emacs/site
;; subdirectory of yourhome directory.
(add-to-list 'load-path (expand-file-name "C:/program file/Java/cedet-1.1/eieio"))
(add-to-list 'load-path (expand-file-name "C:/program file/Java/cedet-1.1/semantic"))
(add-to-list 'load-path (expand-file-name "C:/program file/Java/jdee-2.4.1/lisp"))
(add-to-list 'load-path (expand-file-name "C:/program file/Java/cedet-1.1/common"))
(add-to-list 'load-path (expand-file-name "C:/program file/Java/ecb-2.40"))
(load-file (expand-file-name "C:/programfile/Java/cedet-1.1/common/cedet.el"))
(add-to-list 'load-path (expand-file-name "C:/program file/Java/elib-1.0"))
;; If you want Emacs todefer loading the JDE until you open a
;; Java file, edit thefollowing line
(setq defer-loading-jde t)
;; 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))
6) 注册JDK到JDE,详细可参考http://stuff.mit.edu/afs/athena/contrib/xemacs/share/2006-12-21/xemacs-packages/etc/jde/doc/html/jde-ug/jde-ug.html:
运行Emacs,输入 M-xcustomize-variable 回车
输入jde-jdk-registry 回车,弹出设置窗口
点击INS,在弹出的相应地方输入jdk的版本号和安装路径,例:
Version: 1.7.0_67
Path: c:\program file\Java\jdk1.7.0_67
单击State -> Save for Future Sessions-> Exit
输入M-x customize-variable 回车
输入jde-jdk回车,弹出的窗口中能看到刚才注册的JDK版本,确定其被选为当前使用版本
7) 基本设置完毕,新建一个java文档 HelloWorld.java
classHelloWorld {
public static void main (String[] args) {
System.out.println("Hello, world!");
}
}
8) JDE-> Compile 或者C-c C-v C-c编译
JDE -> Run App 或者C-c C-v C-r 运行
此时如果弹出提示:“The jde does not recognizejdk 1.7.0_67 javac. Assume 1.6 javac?”,是因为jdk1.7仍被识别为1.6,可重复以上步骤6将版本改为1.6。
看到下方console显示结果Hello World!
Java开发环境设置完成。
3864

被折叠的 条评论
为什么被折叠?



