〖Linux〗多個JDK版本之間快速切換

#!/bin/shhtml

usage: . this_file [argvs]

jdk6_home=~/apt/jdk1.6.0_34 jdk7_home=~/apt/jdk1.7.0_67 jdk8_home=~/apt/jdk1.8.0_05java

默認JDK6

case $1 in jdk6 ) export JAVA_HOME=$jdk6_home ;; jdk7 ) export JAVA_HOME=$jdk7_home ;; jdk8 ) export JAVA_HOME=$jdk8_home ;; * ) export JAVA_HOME=$jdk6_home ;; esacoracle

export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/libthis

使用方法:htm

  例如:在須要切換的JDK7的時候,在Shell中執行 . [腳本文件名] jdk7get

  前提:把JDK7下載並解壓到 ~/apt/jdk1.7.0_67(根據自身需求修改)jdk

JDK版本下載連接:file

  Java SE 1.1:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase11-419415.html   Java SE 1.2:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase12-419414.html   Java SE 1.3:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase13-419413.html   Java SE 1.4:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase14-419411.html   JDK5下載:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html   JDK6下載:http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html   JDK7下載:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html   JDK8下載:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlnetwork

相關文章
相關標籤/搜索