1, the official website download jdk.tar.gz package, after decompression is installs the JDK
2, enter the [email protected]:~/android/jdk1.8.0_11/bin directory, you can see Java and other programs
Enter java-version hint
The program ' Java ' Can is found in the following packages:
* DEFAULT-JRE
* Gcj-4.6-jre-headless
* Openjdk-6-jre-headless
* Gcj-4.5-jre-headless
* Openjdk-7-jre-headless
Try:sudo apt-get Install <selected package>
This means that the environment variable is not set and the Java command cannot be found if the input./java-version is correct.
3. Add Environment variables
The path to the Bin folder of the JDK is seen through the PWD command/home/cjh/android/jdk1.8.0_11/bin
By Export path= $PATH:/home/cjh/android/jdk1.8.0_11/bin
After adding, Echo $PATH command to see if the add succeeded
Java-version can get the right results in any position.
- Classpath configuration
- CLASSPATH and path differences see the http://blog.csdn.net/mydreamongo/article/details/8155408
The above is only configured with path, and it needs to be configured Classth
Export classpath=.:/ Home/cjh/android/jdk1.8.0_11/jre/lib
Execution Configuration Complete
java.sh Configuration
Because after the reboot, it will be restored, the following also need to configure the java.sh
This can be done by
Cd/etc/profile.d
VI java.sh
Put the following two lines into the java.sh
Export path= $PATH:/home/cjh/android/jdk1.8.0_11/bin
Export classpath=.:/ Home/cjh/android/jdk1.8.0_11/jre/lib
Save. This will be configured.
Ubuntu Install Java JDK environment variable settings