GNU Emacs下设置Java编程环境(JDEE)


准备文件:

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开发环境设置完成。

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值