2017.3.1 Update
Fixed a number of commands, now follow the article steps to configure the problem will not occur. JDK Installation and configuration
Reference Source: http://www.linuxidc.com/Linux/2017-02/140908.htm
System version: Ubuntu 16.04.2 LTS
JDK version: jdk1.8.0_121
1. Website download jdk file: jdk-8u121-linux-x64.tar.gz
The above is the latest version, other versions can also
2. Create a directory as the installation directory for JDK, my directory is/opt/java
sudo mkdir/opt/java
3. Move the files to the/opt/java directory
sudo mv Jdk-8u121-linux-x64.tar.gz/opt/java
4. Extract Files
TAR-ZXVF jdk-8u121-linux-x64.tar.gz
5. Configure Environment variables
sudo gedit/etc/environment
Add the following configuration at the end (the Java_home path is the JDK file location)
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games: $JAVA _home/bin"
export classpath=.: $JAVA _home/lib: $JAVA _home/jre/lib
Export java_home=/opt/java/jdk1.8.0_121
Save the shutdown after the modification is complete, and enter the following command to make the environment variable effective immediately
Source/etc/environment
6. Also need to configure the environment variables for all users
sudo gedit/etc/profile
At the end of the file, add the following:
#set Java Environment
export java_home=/opt/java/jdk1.8.0_121
export jre_home= $JAVA _home/jre
Export Classpath=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATH
export path= $JAVA _home/bin: $JRE _home/bin: $PATH
7. Similarly, you need to use commands to make environment variables effective immediately
Source/etc/profile
8. Input java-version, display JDK version Description Congratulations, environment variables are configured correctly
9. Restart the computer, the normal access to the system, and java-version command effective Eclipse installation and configuration
Reference source 1:http://jingyan.baidu.com/article/495ba841e8383038b20ede4b.html
Reference source 2:http://www.linuxidc.com/linux/2016-07/133482.htm
Reference source 3:http://www.cnblogs.com/dartagnan/archive/2010/12/01/2003528.html
1. Website download Eclipse IDE for Java EE developers (64-bit): eclipse-jee-neon-2-linux-gtk-x86_64.tar.gz
It's best to use whatever package you want, and we all know that Eclipse Installer This installation package is basically obsolete without the extranet.
2. Install eclipse to extract it into the/opt/folder
sudo tar zxvf eclipse-jee-neon-2-linux-gtk-x86_64.tar.gz-c/opt
3. Create the Eclipse Desktop shortcut icon.
CD ~/Desktop
sudo touch eclipse.desktop
sudo vim eclipse.desktop
Enter the following content:
Save.
Execution: sudo chmod 775 eclipse.desktop it into an executable file.
4. On the desktop to open eclipse, the result is not installed JDK,JRE environment, obviously we have installed.
Workaround: See Eclipse start error below (or) use Java Installer to perform eclipse-inst error
In this case, the following will appear:
A Java RunTime Environment (JRE) or Java Development Kit (JDK) must is available in order to run Eclipse. No Java Virtual machine is found after searching the following locations: ...
Solution:
1. Enter your eclipse directory at the terminal (if you are starting Java Installer then go to the appropriate directory)
2. Then enter:
mkdir JRE
CD JRE
Ln-s/opt/java/jkd1.8.0_121/bin/(here is your path to installing Java)
PostScript
Here I have installed the software in the/opt path, personal habits. Usually, please do not install directly under this path. Because/OPT is generally only accessible to root users, it can be cumbersome to use when developing a regular user.