debian
感谢 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 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://www.bubuko.com/infodetail-2138550.html