debian9 JDK环境变量设置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了debian9 JDK环境变量设置相关的知识,希望对你有一定的参考价值。
感谢 http://www.mkyong.com/java/how-to-install-oracle-jdk-8-on-debian/,让我解决了问题
本来以为debian与centos的环境变量设置是一样的,修改/etc/profile就可以了,但是修改完成后,一直显示的是
[email protected]:/home/java# java -version java version "1.5.0" gij (GNU libgcj) version 6.3.0 20170516 Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [email protected]:/home/java# which java /usr/bin/java [email protected]:/home/java# ls -l /usr/bin/java lrwxrwxrwx 1 root root 22 Jun 24 18:24 /usr/bin/java -> /etc/alternatives/java [email protected]:/home/java# update-alternatives --config java There is only one alternative in link group java (providing /usr/bin/java): /usr/bin/gij-6 Nothing to configure. [email protected]:/home/java#
需要切换软链接指向
[email protected]:/opt/jdk/jdk1.8.0_131# update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_131/bin/java 100 update-alternatives: warning: /etc/alternatives/java is dangling; it will be updated with best choice update-alternatives: using /usr/bin/gij-6 to provide /usr/bin/java (java) in auto mode [email protected]:/opt/jdk/jdk1.8.0_131# update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_131/bin/javac 100 update-alternatives: using /opt/jdk/jdk1.8.0_131/bin/javac to provide /usr/bin/javac (javac) in auto mode [email protected]:/opt/jdk/jdk1.8.0_131# update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/gij-6 1060 auto mode 1 /opt/jdk/jdk1.8.0_131/bin/java 100 manual mode 2 /usr/bin/gij-6 1060 manual mode Press <enter> to keep the current choice[*], or type selection number: 1 update-alternatives: using /opt/jdk/jdk1.8.0_131/bin/java to provide /usr/bin/java (java) in manual mode [email protected]:/opt/jdk/jdk1.8.0_131# update-alternatives --config javac There is only one alternative in link group javac (providing /usr/bin/javac): /opt/jdk/jdk1.8.0_131/bin/javac Nothing to configure. [email protected]:/opt/jdk/jdk1.8.0_131# java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) [email protected]:/opt/jdk/jdk1.8.0_131#
OK。。。
本文出自 “茶叶沫” 博客,请务必保留此出处http://chayemo.blog.51cto.com/13018459/1941703
以上是关于debian9 JDK环境变量设置的主要内容,如果未能解决你的问题,请参考以下文章