Home>Article>Operation and Maintenance> What to do if linux jdk does not take effect

What to do if linux jdk does not take effect

藏色散人
藏色散人 Original
2020-05-29 12:01:43 3372browse

What to do if linux jdk does not take effect

What should I do if the linux jdk does not take effect?

Linux After modifying jdk, it does not take effect. I encountered it once before but didn't record it. I will record it this time.

1. Install jdk1.8.

2. Modify JAVA_HOME in /etc/profile to the new jdk path, and execute source /etc/profile.

3. Execute java -version. At this time, the jdk version is still shown as 1.7.

4. Execution:

which java which javac

Delete the java and javac files in the execution results of the above two instructions.

5. Execute:

ln -s $JAVA_HOME/bin/java /usr/bin/java ln -s $JAVA_HOME/bin/javac /usr/bin/javac

6. Execute:

source /etc/profile

7. Execute java -version, you can see that jdk is switched to version 1.8.

Note:

1. If the execution error is that the java file does not have permissions, first set the permissions for the java file: chmod u x java.

Recommended: "linux tutorial"

The above is the detailed content of What to do if linux jdk does not take effect. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to turn off selinux Next article:How to turn off selinux