setting JAVA_HOME & CLASSPATH in CentOS 6

后端 未结 7 2557
无人共我
无人共我 2020-12-15 04:45

I have unpacked my jdk in /usr/java/.

and I put CLASSPATH, PATH, JAVA_HOME into /etc/profile like below.

export JAVA_HOME=/usr/java/jdk1.7.0_21
expor         


        
7条回答
  •  孤城傲影
    2020-12-15 04:57

    Instructions:

    1. Click on the Terminal icon in the desktop panel to open a terminal window and access the command prompt.
    2. Type the command which java to find the path to the Java executable file.
    3. Type the command su - to become the root user.
    4. Type the command vi /root/.bash_profile to open the system bash_profile file in the Vi text editor. You can replace vi with your preferred text editor.
    5. Type export JAVA_HOME=/usr/local/java/ at the bottom of the file. Replace /usr/local/java with the location found in step two.
    6. Save and close the bash_profile file.
    7. Type the command exit to close the root session.
    8. Log out of the system and log back in.
    9. Type the command echo $JAVA_HOME to ensure that the path was set correctly.

    set java_home in centos

提交回复
热议问题