Configuring Java Home variables for Linux

Source: Internet
Author: User
Tags valid

Configure Java home variables in Linux, and if you search the Web, most of the answers you might find are:

Export Java Home=your/java/path

The problem is that the variable set in this way is only valid for the current user's current session, if you open another shell to execute:

Echo $Java Home

The results shown are still null values. When you turn on the next time you have to reset, so it is not recommended to use this method, so you want to configure Java home variables for Linux, and to implement a configuration lifetime use only need to follow the method configuration can:

Open the/etc/profile file as root, and locate this line similar to the following:

Export PATH USER LOGNAME MAIL HOSTNAME histsize inputrc

Insert the following on it:

Java Home=/home/loocao/software/java/jdk1.6.0_13
JRE_HOME=$Java Home/jre
CLASSPATH=.:$Java Home/lib:$JRE_HOME/lib:$CLASSPATH
PATH=$Java Home/bin:$JRE_HOME/bin:$PATH 

Then edit the export statement and at the end add Java home, as follows:

Export PATH USER LOGNAME MAIL HOSTNAME histsize inputrc Java Home CLASSPATH jre_home

Configuration complete, follow the java-version command test.

Note: The computer needs to be restarted before it can take effect.

Variables configured in this way are valid for all local users, and different users do not need to repeat the settings.

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.