Configuring Java environment variables under Linux, so easy!!

Source: Internet
Author: User
Tags echo display

First, in Cd/usr, mkdir java.

Put the Java installation package into/usr/java and unzip it.

Verify Java.

$ java-version

If prompted, the following installation package contains it, but it is not installed. Is the reason that the environment variable is not configured.

(You can enter the Java decompression package inside the validation, it is feasible to indicate that the Java package is not a problem!) )

Configure the environment variable, vi/etc/profile add the following code at any location

#Set Java Environment
Export path= $PATH:/usr/java/jdk1.8.0_25/bin
Export classpath=.:/ Usr/java/jdk1.8.0_25/jre/lib

Save, restart Linux, then!

Add:

To view environment variables:
Echo $PATH

To configure a Java environment variable:
#Set Java Environment
Export path= $PATH:/usr/java/jdk1.8.0_25/bin
Export classpath=.:/ Usr/java/jdk1.8.0_25/jre/lib

Execute the above command! , but the terminal restart will fail.
(The environment variable is often modified in the/etc/profile file, where the content is modified to work for all users.)
Edit the environment variables using the Modify. bashrc file, which is useful only to the current user. )

Write these two commands to VI/ETC/BASH.BASHRC

Run: Source BASH.BASHRC, make settings effective! Can solve the problem of failure after restarting!

The name of the environment variable is generally capitalized

Show all environment variables $ env
Display environment variable HOME value $ echo $HOME
Env is an external command, program file/bin/env, used to list all environment variables and their assignments.

Export setting environment variables
echo display text, print text
Set is used to display local variables, displaying variables for the current shell, including variables for the current user

Configuring Java environment variables under Linux, so easy!!

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.