您的位置:首页 > 运维架构 > Linux

linux切换JDK版本

2015-07-17 18:53 531 查看
Check what are the java versions are installed on your system

#java -version

Example output

OpenJDK Runtime Environment (build 1.6.0-b09)

OpenJDK Client VM (build 1.6.0-b09, mixed mode)

So now I want to change the one version to another version.

If more than one java is installed. Execute below command to see how many java versions are installed? And what is the default version (Default version will be indicated by *)



#update-alternatives –config java


This command will display which is default java version used by your machine..

Example output.

# update-alternatives –config java

There are 2 programs which provided ‘java’.

Selection Command

———————————————–

1. /usr/lib/jvm/jre-1.4.2-gcj/bin/java

*+ 2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java

Enter to keep the current selection[+], or type selection number:





So if you want to change the java version from 1.6 (now 2 is default version as shown) to 1.4 just press “1” with
out quotes.

Please let us know if you know other way of changing java version.

Please visit http://www.linuxnix.com for more linux admin stuff

本文来自于:
http://www.linuxnix.com/2010/12/how-to-change-the-java-version-in-linux.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: