1024programmer Linux What to do if linuxjdk does not take effect-linux operation and maintenance

What to do if linuxjdk does not take effect-linux operation and maintenance

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!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/what-to-do-if-linuxjdk-does-not-take-effect-linux-operation-and-maintenance/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索