What to do if linux jdk does not take effect

藏色散人
Release: 2020-05-29 12:01:43
Original
3498 people have browsed it

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
Copy after login

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
Copy after login

6. Execute:

source /etc/profile
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template