折腾了半天JDEE,终于折腾好了。
(add-to-list ‘load-path "~/.emacs.d/plugins/jdee-2.4.1/lisp") (autoload ‘jde-mode "jde" "JDE mode" t) (setq auto-mode-alist (append ‘(("\\.java\\‘" . jde-mode)) auto-mode-alist)) (defun my-jde-bsh-run () ;; 进入jde自动启动beanshell,否则会在每次运行jde命令的时候再启动,比较慢。 (save-excursion (jde-bsh-run))) (add-hook ‘jde-mode-hook ‘my-jde-bsh-run)
(jde-project-file-version "1.0") (jde-set-variables ;; 配置jdk ‘(jde-jdk-registry (quote (("1.6" . "/usr/java/jdk1.7.0_51")))) ‘(jde-jdk (quote ("1.6"))) ;; 每次编译后更新交叉引用 ‘(jde-ant-build-hook (quote (jde-compile-finish-kill-buffer jde-compile-finish-refresh-speedbar jde-compile-finish-update-class-info my-jde-compile-finish-update-xref))) ‘(jde-compile-finish-hook (quote (jde-compile-finish-kill-buffer jde-compile-finish-refresh-speedbar jde-compile-finish-update-class-info my-jde-compile-finish-update-xref))) ;; 交叉引用配置 ‘(jde-xref-db-base-directory "./xrefdb") ‘(jde-xref-store-prefixes (quote (""))) ‘(jde-xref-cache-size 10) ;; 使用ant作为build命令(build.xml放在项目根目录下就可以,通过下面的配置可以让JDEE自己找) ‘(jde-build-function (quote jde-ant-build)) ‘(jde-ant-read-target t) ‘(jde-ant-enable-find t) ;; 配置源文件与class文件路径 ‘(jde-sourcepath (quote ("./src"))) ‘(jde-built-class-path (quote ("./bin"))) ‘(jde-global-classpath (quote ("./bin"))) ;; 编辑模式配置 ‘(jde-electric-return-p t) ‘(jde-enable-abbrev-mode t))
(defun my-jde-import-organize () (interactive) (jde-import-all) (jde-import-kill-extra-imports) (jde-import-organize) ) (defun my-jde-compile-finish-update-xref (buf msg) (with-current-buffer buf (if (null (or (string-match ".*exited abnormally.*" msg) (string-match ".*BUILD FAILED.*" (buffer-string)))) ;;no errors, make the compilation window go away in a few seconds ;;there were errors, so jump to the first error (jde-xref-make-xref-db)))) (defun my-jde-xref-list-uncalled-functions (strict) (interactive "P") (kill-buffer (get-buffer-create "Unreferenced Methods and Members")) (jde-xref-list-uncalled-functions strict) ) (define-key java-mode-map (kbd "C-SPC") ‘jde-complete) (define-key java-mode-map (kbd "C-S-m") ‘jde-import-all) (define-key java-mode-map (kbd "C-S-o") ‘my-jde-import-organize) (define-key java-mode-map (kbd "C-S-b") ‘jde-debug-toggle-breakpoint) (define-key java-mode-map (kbd "C-S-s") ‘jde-jdb-set) (define-key java-mode-map (kbd "C-S-l") ‘jde-jdb-locals) (define-key java-mode-map (kbd "C-S-v") ‘jde-jdb-print) (define-key java-mode-map (kbd "C-S-d") ‘jde-jdb-dump) (define-key java-mode-map (kbd "C-S-u") ‘jde-debug-up) (define-key java-mode-map (kbd "C-S-g") ‘jde-xref-display-call-tree) (define-key java-mode-map (kbd "C-S-f") ‘jde-xref-first-caller) (define-key java-mode-map (kbd "C-S-n") ‘jde-xref-next-caller) (define-key java-mode-map (kbd "C-S-r") ‘my-jde-xref-list-uncalled-functions) (define-key java-mode-map [f2] ‘jde-rename-class) (define-key java-mode-map [f3] ‘jde-open-class-at-point) (define-key java-mode-map [f5] ‘jde-debug-step-into) (define-key java-mode-map [f6] ‘jde-debug-step-over) (define-key java-mode-map [f7] ‘jde-debug-step-out) (define-key java-mode-map [f8] ‘jde-debug-cont) (define-key java-mode-map [C-f9] ‘jde-build) (define-key java-mode-map [C-f10] ‘jde-debug) (define-key java-mode-map [C-f11] ‘jde-run)
原文:http://blog.csdn.net/yaosongyuan/article/details/21963427