Fedora OpenJDK Set JAVA_HOME

一笑奈何 提交于 2019-12-05 20:14:24

You can add in your .bashrc file:

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")

and it will dynamically change when you update your packages.

Use the following command to find out exact path to which java executable under UNIX / Linux:

$ which java (suppose returns /usr/java/jdk1.5.0_07/bin/java)

And then set path as export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java

Best solution tested with Fedora 26 :

echo "JAVA_HOME=/etc/alternatives/jre" >> ~/.profile
source ~/.profile
echo $JAVA_HOME
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!