Ubuntu Install Java JDK environment variable settings

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.