by shigemk2

当面は技術的なことしか書かない

MacのEmacsでJDEEを設定してみよう

環境

導入

  1. JDEEとCEDETをダウンロードする。 Java Development Environment for Emacs Collection of Emacs Development Environment Tools Homepage (後述しますが、elibとantはインストール不要)

  2. ダウンロードしたファイルを解凍して然るべきディレクトリに配置する

  3. init.elにごにょごにょ書く

;; cedet
;(load-library "cedet")
(load-library "~/.emacs.d/elisp/cedet-1.1/common/cedet.el")
(global-ede-mode 1)
;(semantic-mode 1)

(setenv "JAVA_HOME" "/Library/Java/Home")
(setenv "ANT_HOME" "/usr/share/java/ant-1.8.2")
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/jdee-2.4.1/lisp"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/cedet-1.1/common"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/cedet-1.1/semantic"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/cedet-1.1/eieio"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/cedet-1.1/speedbar"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/cedet-1.1/cogre"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/cedet-1.1/ede"))
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/cedet-1.1/srecode"))
;; (add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp/elib-1.0/lisp/elib"))

(require 'cedet)
(require 'jde)
(setq compilation-window-height 8)

(require 'jde-ant)
(setq jde-ant-enable-find t)
(setq jde-ant-home "/usr/share/java/ant-1.8.2")
(setq jde-ant-program "/usr/bin/ant")
(setq jde-ant-read-target t)
(setq jde-build-function (quote (jde-ant-build)))

ハマリドコロ

antについて

macにはもともとantが入っているようなので、イチからインストールする必要はない。 手動でごにょごにょしようとして、build.xmlのifプロパティでコケたとか色々問題はあったけど、 それはもういいや。

elibについて

elib - GNU Project - Free Software Foundation (FSF)によると、

Elib has been decommissioned as a separate package since its useful functions have long since been included in Emacs. The remainder of this page is kept just for historical purposes.

とのことで、要するにElibを別途インストールする必要はないと。

JDEEについて

おはっ、GitHubでレポジトリが公開されとる!と思い

$git submodule add https://github.com/emacsmirror/jdee.git

とかやってみたけど、 なんかいろいろエラーが出たわ。

だから、普通に公式からファイルを落としたところ、普通に動きました。

いろいろ参考にしたサイト

MacでEmacsでJDEEを設定する - toshiaki_tの技術系体当たり JDEEを使ってみる - gom68の日記 Emacs+JDEEでAndroid開発 ~環境構築~ | hiroki.kanaの日常 kakakikikekeのブログ: emacsでJava開発をするためにJDEEを入れてみた Used by JDE developers to discuss JDE development issues and business