首页 > 代码库 > debian9 JDK环境变量设置
debian9 JDK环境变量设置
感谢 http://www.mkyong.com/java/how-to-install-oracle-jdk-8-on-debian/,让我解决了问题
本来以为debian与centos的环境变量设置是一样的,修改/etc/profile就可以了,但是修改完成后,一直显示的是
root@dabian:/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. root@dabian:/home/java# which java /usr/bin/java root@dabian:/home/java# ls -l /usr/bin/java lrwxrwxrwx 1 root root 22 Jun 24 18:24 /usr/bin/java -> /etc/alternatives/java root@dabian:/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. root@dabian:/home/java#
需要切换软链接指向
root@dabian:/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 root@dabian:/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 root@dabian:/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 root@dabian:/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. root@dabian:/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) root@dabian:/opt/jdk/jdk1.8.0_131#
OK。。。
本文出自 “茶叶沫” 博客,请务必保留此出处http://chayemo.blog.51cto.com/13018459/1941703
debian9 JDK环境变量设置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。