I found that there were no articles on how to configure the Java environment in Emacs24 on the Internet. If I upgrade Emacs23 directly, some problems may occur. I took the time to summarize these problems and write them to friends in need, to save your time. When CEDET and JDEE are installed in Emacs24 to implement the Java environment, some problems may occur, mainly because these plug-ins are not updated synchronously with Emacs. 1. cedet-1.1cedet: CEDET is a Collection of Emacs Development Environment Tools Project address: http://cedet.sourceforge.net/make if compilation encounters problems, execute make clean-autoloadsmake clean-all if the makeinfo command is not found, download sudo apt-get install texinfo to download the corresponding installation package. Put the downloaded and compiled CEDET ~ /. Emacs. d/down 2. elib-1.0 3. JDEE 2.4.0.1 by (defconst jde-cedet-max-version "1.0" for (defconst jde-cedet-max-version "1.1" delete/jdee-2.4.0.1/lisp/jde at the same time. elc does this because the maximum Emacs version set by JDEE is not compatible with 24. Therefore, we need to modify the version to 1.1 to adapt to Emacs24 and delete jde. elc allows emacs to read non-compiled jde. el. 4. Install ECB-2.40. ECB is a tool used to browse code on emacs.: Http://ecb.sourceforge.net/Go To The ECB-2.40 directory and execute make if you encounter Byte-compiling ECB with LOADPATH =... It indicates that the path in your make file is not correctly configured, and the ECB depends on CEDET. In this case, you need to modify the makefile file to load the correct CEDET path. Open the Makefile file and find 51 lines. Modify the CEDET = line. The path is your path for cedet1.1. If you encounter: ECB 2.40-Error: ECB can only be used with cedet [1.0pre6, 1.0.9]! Please install it and restart Emacs!. Comment out the following code for the ecb-upgrade.el. Then re-compile the ECB in make; check if vedet-version is correct (when (or (not (boundp 'cedet-version )) (ecb-package-version-list <(ecb-package-version-str2list cedet-version) ecb-required-cedet-version-min) (ecb-package-version-list <ecb-required-cedet-version-max (ecb-package-version-str2list cedet-version ))) (setq version-error (concat "cedet [" cedet-required-version-str-min "," cedet-required-version-str -Max "]") in ~ /. Add (add-to-list 'Load-path "~ /. Emacs. d/ecb-2.40 ") (require 'ecb) 5. JDK installation JDK this is not much to say. 6. add the following startup command in the Ubuntu user root directory. add the following content to emacs to start JDEE, avoid some fatal errors, and automatically load JDEE when loading Java files .;; Add jdee cedet and jdee (add-to-list 'Load-path "~ /. Emacs. d/cedet-1.1/common ") (load-file "~ /. Emacs. d/cedet-1.1/common/cedet. el ") (add-to-list 'Load-path "~ /. Emacs. d/jdee-2.4.0.1/lisp ") (add-to-list 'Load-path (expand-file-name "~ /. Emacs. d/elib-1.0 ") (require 'jde); add ecb (add-to-list 'load-path "~ /. Emacs. d/ecb-2.40 ") (require 'ecb); we need some lisp to prevent fatal errors. (defun screen-width nil-1) (setq jde-check-version-flag nil) (define-obsolete-function-alias 'make-local-hook 'ignore "21.1 ") (unless (fboundp 'semantic-format-prototype-tag-java-mode) (defalias 'semantic-format-prototype-tag-java-mode 'semantic-format-tag-prototype-java-mode) (require 'hippie-exp );; we use something to load JDEE for. java files :( add-to-list 'Load-path (format "% s/lisp ""~ /. Emacs. d/jdee-2.4.0.1 "" Path to JDEE ") (autoload 'jde-mode" jde "" jde mode. "t) (setq auto-mode-alistwww.2cto.com (append '(("\\. java \\'". jde-mode) auto-mode-alist) 7. restart emacs. After the preceding steps run normally, we need to configure JDE to run JDK (1) and input M-x mimize-variable. At this time, we will prompt you to configure the variables, enter jde-jdk-registry,
(2) The interface appears, as shown in figure. Click INS to add your JDK version and JDK path. (3) Click the State button and select Save for Future Sessions in the pop-up menu. (4) type M-x customize-variable again, and enter jde-jdk in variable selection to go to the following interface and select the JDK you want, click State and select Save for Future Sessions. (5) After completing the preceding steps, JDE automatically adds the corresponding configuration to your. emacs file. (6) Restart Emacs24 to run JDE normally.