Introduction to Emacs Java Development
I have summarized the skills for developing Java applications (including TestNG and Web applications) with Emacs and Maven on Ubuntu over the years. I hope this will help my friends who are interested in Linux development. I am not opposed to IDE development, but many times, Emacs can bring faster speed (and have little requirements on machine hardware) and have a better understanding of Java engineering, it is easier to communicate with engineers in the Open Source Field. I still don't like to use the mouse very much. Emacs allows me to free my right hand.
Install
1. Make sure that you have installed JDK
2. Make sure you have installed Maven
3. install Emacs: sudo apt-get install emacs
4.download jdee-bin-2.4.0.1.zipand the dependent file elib-1.0.zip, address here: http://sourceforge.net/projects/jdee/files/
5. Extract the two files to the/opt/emacs_plugins/directory.
6. You also need to download the ecb-2.40 and ecb. el, also in the emacs_plugins directory
7. Download The javadoc-help javadoc-help.el file and put it under the/opt/emacs_plugins/java directory http://javadochelp.sourceforge.net/
Configure. emacs configure JDEE
; JDEE configuration
(Add-to-list 'Load-path (expand-file-name "/opt/emacs_plugins/jdee-2.4.0.1/lisp "))
(Load-file "/opt/emacs_plugins/cedet-1.0pre7/common/cedet. el ")
(Add-to-list 'Load-path (expand-file-name "/opt/emacs_plugins/elib-1.0 "))
(Add-to-list 'Load-path (expand-file-name "/opt/emacs_plugins/ecb-2.40 "))
; (Add-to-list 'Load-path (expand-file-name "/opt/emacs_plugins/jde-jalopy "))
(Load-file (expand-file-name "/opt/emacs_plugins/ecb-2.40/ecb. el "))
(Require 'font-lock)
(Require 'ecb)
(Require 'ecb-autoloads)
(Require 'jde)
(Custom-set-variables
'(Browse-url-browser-function (quote browse-url-generic ))
'(Browse-url-generic-program "chromium-browser ")
'(Column-number-mode t)
'(Jde-complete-function (quote jde-complete-menu ))
'(Jde-debugger (quote ("jdb ")))
'(Jde-jdk-registry (quote ("1.6.0 _ 35". "/usr/jdk1.6 "))))
'(Jde-resolve-relative-paths-p t)
'(Jde-run-option-debug (quote ("Server" "Socket" "javadebug" nil "5005" t ))))
View API documentation
Unfortunately, javadoc-helper cannot retrieve jdk documents. Keep a bookmarks in your browser instead.
; Java document support
(Add-to-list 'Load-path (expand-file-name "/opt/emacs_plugins/java "))
(Require 'javadoc-help)
(Javadoc-set-predefined-urls '("/opt/java_docs/common-cache-1.0.0-javadoc"
"/Opt/java_docs/commons-codec-1.4-javadoc"
"/Opt/java_docs/commons-logging-1.1.1-javadoc"
"/Opt/java_docs/ehcache-server-1.0.0-javadoc"
"/Opt/java_docs/gson-1.7.1-javadoc"
"/Opt/java_docs/jcommander-1.12-javadoc"
"/Opt/java_docs/jersey-apache-client-1.9.1-javadoc"
"/Opt/java_docs/jersey-client-1.9.1-javadoc"
"/Opt/java_docs/jersey-core-1.9.1-javadoc"
"/Opt/java_docs/joda-time-1.6.2-javadoc"
"/Opt/java_docs/junit-4.8.2-javadoc"
"/Opt/java_docs/logback-classic-1.0.0-javadoc"
"/Opt/java_docs/logback-core-1.0.0-javadoc"
"/Opt/java_docs/lombok-0.10.4-javadoc"
"/Opt/java_docs/mongo-java-driver-2.7.2-javadoc"
"/Opt/java_docs/mybatis-3.0.5-javadoc"
"/Opt/java_docs/slf4j-api-1.6.4-javadoc"
"/Opt/java_docs/snakeyaml-1.6-javadoc"
"/Opt/java_docs/testng-6.1.1-javadoc "))
(Global-set-key [(f1)] 'javadoc-lookup); F1 to lookup
(Global-set-key [(shift f1)] 'javadoc-help); Shift-F1 to bring up menu
Note: The above document directories are all downloaded from the Internet. If you use maven to build a project, you can easily use a script file to download the file jar package, and copy it to the/opt/java_docs/directory.
Mvn clean
Mvn dependency: resolve-Dclassifier = javadoc
Rm-rf/opt/java_docs
Mkdir/opt/java_docs
Cp $ (find ~ /. M2/repository/-name * javadoc. jar)/opt/java_docs/
The following script can help me extract all jar files to a directory with the same name.
#! Bin/sh
Path =/opt/java_docs
For f in $ (ls $ path/*. jar );
Do
Name = 'basename $ F'
Name2 = 'echo $ name | sed's/\. jar // g''
Echo $ name2
Mkdir $ path/$ name2
Cd $ path/$ name2
Jar xvf $ path/$ name
Done
Rm-f *. jar
This script can generate the directory path to be configured and used in. emacs.
Path =/opt/java_docs
For f in $ (ls $ path /);
Do
Name = 'basename $ F'
Echo \ "/opt/java_docs/$ name \"
Done
Recommended reading:
For more information about how to install Ubuntu 13.10 on a hard drive in Windows 7, see
Ubuntu 13.10 download, installation, and configuration summary page
Configure the newLISP development environment for Emacs
Teach you how to configure Emacs topics
Learn how to customize Emacs
In the GNU Emacs environment, how does one compile and run C/C ++ programs?
10 things that must be done after Ubuntu 13.10 is installed