What should I do if the linux jdk does not take effect?
After Linux modifies the jdk, it will not take effect. I encountered it once before, but I didn’t record it, so I will remember 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, it shows that jdk is still version 1.7.
4. Execute:
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 java file does not have permission when executing an error report, first set the permission for the java file: chmod u+x java.
Recommendation: “Linux Tutorial”
The above is the detailed content of what to do if the linux jdk does not take effect. For more information, please pay attention to other related articles on 1024programmer.com!