Ubuntu14.04 configure JDK Environment Variables

Source: Internet
Author: User

Step 1: Download the JDK of tar.gz,

Run the sudo tar zxvf./jdk's name.tar.gz-C and the path you want to specify.

Step 2: Modify JDK Permissions

Sudo chmod 766-r your JDK path

Step 3: Press CTRL + ALT + T to open the terminal

Step 4: Enter sudo gedit/etc/profile, the system will pop up the profile text file, and add the following code at the end

# Set Java environment
Export java_home = Your JDK path
Export jre_home =$ {java_home}/JRE
Export classpath =. :$ {java_home}/lib: 4 {jre_home}/lib
Export path =$ {java_home}/bin: $ path

Step 5: Source/etc/profile is used to re-execute the initial or file you just modified to make it take effect immediately

Step 6: install and use openjdk (usr/lib/JVM/) by default in Ubuntu. Therefore, you must manually modify the default JDK

Sudo Update-alternatives -- install/usr/bin/Java your JDK path/bin/Java 300 sudo Update-alternatives -- install/usr/bin/javac your JDK path/ bin/javac 300 sudo Update-alternatives -- install/usr/bin/Jar your JDK path/bin/jar 300 sudo Update-alternatives -- install/usr/bin/javah you JDK path/bin/javah 300 sudo Update-alternatives -- install/usr/bin/javap your JDK path/bin/javap 300 Step 7, sudo Update-alternatives -- config Java

Step 8: Now the configuration is complete. Enter Java-version, javac, or Java to check whether the configuration is successful.

 

Ubuntu14.04 configure JDK Environment Variables

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.