Ubuntu Command installs JDK

Source: Internet
Author: User

1.ubuntu is using OPENJDK, so we need to find the appropriate JDK version first. On the command line, enter the command:

$apt-cache search openjdk
    • 1

Return results list (varies by PC):

Default-jdk-doc-standard Java or Java Compatible development Kit (documentation)
... (Omit partial display result)
OPENJDK-6-SOURCE-OPENJDK Development Kit (JDK) source files
Openjdk-7-jre-dcevm-alternative VM for OPENJDK 7 with enhanced class redefinition
OPENJDK-7-JRE-LIB-OPENJDK Java Runtime (architecture Independent libraries)
Openjdk-7-jre-zero-alternative JVM for OpenJDK, using Zero/shark
Openjdk-8-dbg-java runtime based on OPENJDK (debugging symbols)
Openjdk-8-demo-java runtime based on OPENJDK (demos and examples)
OPENJDK-8-DOC-OPENJDK Development Kit (JDK) documentation
OPENJDK-8-JDK-OPENJDK Development Kit (JDK)
OPENJDK-8-JRE-OPENJDK Java Runtime, using Hotspot JIT
OPENJDK-8-JRE-HEADLESS-OPENJDK Java Runtime, using Hotspot JIT (headless)
Openjdk-8-jre-jamvm-alternative JVM for OpenJDK, using JAMVM
Openjdk-8-jre-zero-alternative JVM for OpenJDK, using Zero/shark
OPENJDK-8-SOURCE-OPENJDK Development Kit (JDK) source files
Uwsgi-app-integration-plugins-plugins for integration of UWSGI and application
Uwsgi-plugin-jvm-openjdk-7-Java plugin for UWSGI (openjdk 7)

2. From the search list, find the JDK version we need to install, as shown in the black
OPENJDK-8-JDK-OPENJDK Development Kit (JDK)

3. Enter the installation command to install:

$sudo apt-get install openjdk-8-jdk
    • 1

Wait for the command line to show "done", that is, the installation was successful.

4. Review the installation results. Enter the command:

$java -version
    • 1

The results appear as follows:
OPENJDK Version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~15.10.1-b14)
OpenJDK Server VM (build 25.91-b14, Mixed mode)
This indicates that the installation was successful.

5. After successful installation, you will also need to configure the Java_home variable:

1) Input command: Echo $java _home
Returns a blank line;

2) which Javac
return:/usr/bin/javac

3) File/usr/bin/javac
Back to:/usr/bin/javac:symbolic link To/etc/alternatives/javac

4) File/etc/alternatives/javac
Back to:/etc/alternatives/javac:symbolic link To/usr/lib/jvm/java-8-openjdk-i386/bin/javac

5) File/usr/lib/jvm/java-8-openjdk-i386/bin/javac
return:/usr/lib/jvm/java-8-openjdk-i386/bin/javac:elf 32-bit LSB executable, Intel 80386, version 1 (SYSV), Dynamically link Ed, interpreter/lib/ld-linux.so.2, for Gnu/linux 2.6.32, buildid[sha1]=a8eeb948df0418fc8f046910c73713f2b6697a9a, Stripped

6) sudo echo export java_home= "/usr/lib/jvm/java-8-openjdk-i386/bin" >>~/.BASHRC
Enter the password;

7) Source ~/.BASHRC

8) Test command: Gedit ~/.BASHRC
See if the end of open files is successfully joined Java_home

Ubuntu Command installs JDK

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.