Configuring Java_home Variables for Linux

Source: Internet
Author: User

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, and to achieve a configuration for lifelong 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=your/java/path
Path= $JAVA _home/bin: $PATH

Then edit the export statement, adding java_home at the end, as follows:
Export PATH USER LOGNAME MAIL HOSTNAME histsize inputrc java_home

Configuration complete, follow: 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.

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.