[Newbies] [萌新求助]请教大家为什么JDK配置了环境变量还是不能用呢???
Tofloor
poster avatar
w_g-deepin007
deepin
2021-04-09 07:24
Author

如图,配置好了环境变量,但是输入java -version还是提示未找到命令,有遇到过相同问题的吗??还请大家指点一下,谢谢啦

Reply Favorite View the author
All Replies
lcw0268
deepin
2021-04-09 07:36
#1

sudo ?

Reply View the author
element
deepin
2021-04-09 17:31
#2

估计是不是配置错了哟

https://bbs.deepin.org/zh/post/216110

https://bbs.deepin.org/zh/post/218390

https://bbs.deepin.org/zh/post/213054

你可以试试论坛搜索别人都有成功的

Reply View the author
翻过山峰看见云
deepin
2021-04-09 17:45
#3

这个是我在~/.bashrc中配置的,看论坛里很多人都不建议配置到/etc/profile里。

Reply View the author
强迫症晚期患者
deepin
2021-04-09 17:56
#4

配置后记得刷新。

Reply View the author
Comments
rexlevin
2021-04-09 22:40
这个对的。 要么source后重开一个terminal,要么重启。
red13
deepin
2021-04-09 21:42
#5

如果是想要全局使用,要配置到 /etc/profile,,,配置完成后,,需要  source /etc/profile

如果只是为了使用jdk,或是多个jdk并存,建议使用

#将java添加到bin

update-alternatives --install /usr/bin/java java /opt/jdk1.6.0_45/bin/java 300

#将javac添加到bin

update-alternatives --install /usr/bin/javac javac /opt/jdk1.6.0_45/bin/javac 300

#JDK版本选择

update-alternatives --config java

方便随时切换...

Reply View the author
w_g-deepin007
deepin
2021-04-10 05:30
#6
lcw0268

sudo ?

恩恩,添加环境变量用了sudo vim /etc/profile

Reply View the author
w_g-deepin007
deepin
2021-04-10 05:32
#7
element

估计是不是配置错了哟

https://bbs.deepin.org/zh/post/216110

https://bbs.deepin.org/zh/post/218390

https://bbs.deepin.org/zh/post/213054

你可以试试论坛搜索别人都有成功的

看了几遍,感觉没哪儿有毛病啊。echo $JAVA_HOME 路径也是对的,难受T-T,感谢大佬,我去搜搜再研究研究

Reply View the author
w_g-deepin007
deepin
2021-04-10 05:33
#8
翻过山峰看见云

这个是我在~/.bashrc中配置的,看论坛里很多人都不建议配置到/etc/profile里。

恩恩我去试试呢,不过我看你这个是openjdk,我是下载的oracle的,不知道一不一样啊。谢谢啦

Reply View the author
w_g-deepin007
deepin
2021-04-10 05:34
#9
强迫症晚期患者

配置后记得刷新。

恩恩我有刷新呢,source  /etc/profile

Reply View the author
w_g-deepin007
deepin
2021-04-10 05:35
#10
red13

如果是想要全局使用,要配置到 /etc/profile,,,配置完成后,,需要  source /etc/profile

如果只是为了使用jdk,或是多个jdk并存,建议使用

#将java添加到bin

update-alternatives --install /usr/bin/java java /opt/jdk1.6.0_45/bin/java 300

#将javac添加到bin

update-alternatives --install /usr/bin/javac javac /opt/jdk1.6.0_45/bin/javac 300

#JDK版本选择

update-alternatives --config java

方便随时切换...

我是想安装Jmeter,然后需要配置一下java环境,我试试呢。谢谢啦

Reply View the author
w_g-deepin007
deepin
2021-04-10 07:31
#11

抱歉各位,是在下疏忽了,JAVA_HOME写成了JAVE_HOME,现在可以了,感谢各位的指点

Reply View the author