论坛首页 综合技术论坛

解决ubuntu7.10下emacs jde不能正常安装的问题

浏览 2558 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-02-26  
自从切换到ubuntu7.10+emacs下后,java环境JDE一直不能正常使用,将就着使用eclipse工作。今天找了一下,发现原因是ubuntu7.10的几个bug,解决方式如下:
1、安装jde
如果直接使用sudo apt-get install jde,一般是会报错的,原因是文件/usr/share/doc-base/jde有一个小错误,注意下面内容中的Section节:
Section: Apps/Programming
Document: jde
Title: JDEE JDE User's Guide
Author: Paul Kinnucan
Abstract: This guide explains how to use the JDE to develop Java applications
 and applets.   The Java Development Environment (JDE) is an Emacs Lisp
 package that interfaces Emacs to third-party Java application development
 tools, such as those provided by JavaSoft's Java Development Kit (JDK). The
 result is an integrated development environment (IDE) comparable in power to
 many commercial Java IDEs.

Format: HTML
Index: /usr/share/doc/jde/html/jde-ug/jde-ug.html
Files: /usr/share/doc/jde/html/jde-ug/*.html

移动一下Section,修改为:
Document: jde
Title: JDEE JDE User's Guide
Author: Paul Kinnucan
Abstract: This guide explains how to use the JDE to develop Java applications
 and applets.   The Java Development Environment (JDE) is an Emacs Lisp
 package that interfaces Emacs to third-party Java application development
 tools, such as those provided by JavaSoft's Java Development Kit (JDK). The
 result is an integrated development environment (IDE) comparable in power to
 many commercial Java IDEs.
Section: Apps/Programming

Format: HTML
Index: /usr/share/doc/jde/html/jde-ug/jde-ug.html
Files: /usr/share/doc/jde/html/jde-ug/*.html

再次安装jde,通过。
建议使用以下命令安装jde:
sudo apt-get install ant checkstyle libtomcat5.5-java jde

2、解决jde不能加载的问题
安装好jde后,打开java文件只能启用cc-mode,并没有启动jde-mode,查看*Message*会发现Error while loading 50jde这样的错误提示。
这是因为/etc/emacs/site-start.d/50jde.el也存在问题,需要添加几行代码(见中文注释部分):
(setq jde-doc-directory "/usr/share/doc/jde")

; Workaround for JDK 1.6

;;加上以下一行
(require 'beanshell)

(require 'jde-compile)
(defclass jde-compile-javac-16 (jde-compile-javac-15)
  ()
  "Class of J2SDK 1.6 javac compilers.")

(defmethod initialize-instance ((this
                                 jde-compile-javac-16) &rest fields)
  ;; Call parent initializer.
  (call-next-method)
  
  ;; Set compiler version.
  (oset this version "1.6"))
 
(add-to-list 'jde-compile-javac-compilers
             (jde-compile-javac-16 "javac 1.6.x") t)

;;加上以下两行
(autoload 'jde-mode "jde" "Java Development Environment" t)
(add-to-list 'auto-mode-alist '("\\.java$" . jde-mode))

这一修改参考自http://www.emacswiki.org/cgi-bin/wiki/JavaDevelopmentEnvironment,但emacswiki上的内容有一些笔误,按上面的修改,测试通过。
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics