DEBIAN8 (Jessie) Installation configuration Java environment Step

Source: Internet
Author: User
Tags mixed


The system is DEBIAN8, Jessie, and the default Java version is: OpenJDK 1.7

1. Check the current system's Java version

leung@phychion:~$ java-version
Java Version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-4)
OpenJDK 64-bit Server VM (build 24.65-b04, Mixed mode)

2. Configure installation Java:

leung@phychion:~/downloads$ Tar zxf jdk-7u67-linux-x64.tar.gz
leung@phychion:~/downloads$ sudo mv jdk1.7.0_67/usr/lib/jvm/

3. Edit/etc/profile, add environment variables:

leung@phychion:~/downloads$ sudo vi/etc/profile
Export java_home=/usr/lib/jvm/jdk1.7.0_67
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH

4. Use environment variables to take effect without having to log on to the shell again:

leung@phychion:~/downloads$ Source/etc/profile

5. Configure the JDK1.7 Java,javac tool:
leung@phychion:~$ sudo update-alternatives--install/usr/bin/java java/usr/lib/jvm/jdk1.7.0_67/bin/java 300
leung@phychion:~$ sudo update-alternatives--install/usr/bin/javac javac/usr/lib/jvm/jdk1.7.0_67/bin/javac 300
Update-alternatives:using/usr/lib/jvm/jdk1.7.0_67/bin/javac to Provide/usr/bin/javac (javac) in Auto mode

6. Set the default Java version of the system, here Select 2:
leung@phychion:~$ sudo update-alternatives--config java
There are 2 choices for the alternative Java (Providing/usr/bin/java).

Selection Path Priority Status
------------------------------------------------------------
* 0/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 Auto mode
1/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 Manual Mode
2/usr/lib/jvm/jdk1.7.0_67/bin/java Manual Mode

Press ENTER to keep the current choice[*], or type selection number:2
Update-alternatives:using/usr/lib/jvm/jdk1.7.0_67/bin/java to Provide/usr/bin/java (Java) in manual mode

leung@phychion:~$ sudo update-alternatives--config javac
There is only one alternative in link Group Javac (providing/usr/bin/javac):/usr/lib/jvm/jdk1.7.0_67/bin/javac
Nothing to configure.

7. Confirm the Java version of the settings:


leung@phychion:~$ java-version
Java Version "1.7.0_67"
Java (TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot (TM) 64-bit Server VM (build 24.65-b04, Mixed mode)

Related Article

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.