CentOS sets System variables for OPENJDK

Source: Internet
Author: User

On CentOS, the default is self-openjdk, and when executing java–version, you can see output similar to the following:


However, when you execute Javac, you are prompted to find the command you entered. The reason is that the CentOS default only comes with the OPENJDK runtime (JRE). If you need a JDK, you'll need to install it yourself. If you need Java development on Linux, you need to compile Java code, or do other related (such as Hadoop) development work, it is necessary to install the JDK.

So how do you install it? It's very simple, actually. As long as you execute the following command, it is usually OK:

Su-c "Yum Installjava-1.7.0-openjdk-devel"

After entering this command, the terminal will see a lot of output, but after seeing output similar to the following, it means that the installation is complete:

Of course, this time still can't execute javac. Don't forget to configure environment variables for the JDK!

OPENJDK the installed directory is located in/USR/LIB/JVM. If you enter this directory between the installation Openjdk_devel, you see the JRE folder, similar to the following:


And when you're done, this directory looks like this:


In the Bin folder below these Java directories, you will see the Javac command. This is the JDK.

you only need to open the environment variable file in the terminal Vim/etc/profile , fill in the appropriate directory:   

Export Java_home=/usr/lib/jvm/java
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export path= $PATH: $JAVA _home/bin

This allows us to set up the JDK, which will take effect when the Source/etc/profile is entered.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

CentOS sets System variables for OPENJDK

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.