Busy people jdk8, born later than the passion of several summer

Written for busy people jdk8 at hand, the first thing you blinded, mac installed jdk7, jdk switching functions to be out of the whole job, just great jdk8up101 installation, pretending few lines of code to get
the goal
at the command line, you can command 'jdk6', 'jdk7', 'jdk8' easy to switch to the corresponding Java version, the default initial set jdk7.

practice

1. First install all JDk:

  • Mac comes with the JDK6, installed in the directory: under /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/.
  • JDK7, JDK8 need to own to Oracle's official website to download and install the corresponding version. JDK own installation default path is: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk
  1. Bash configuration file in the user's directory path in .bashrc configuration of JAVA_HOME:
    · · ·
    Export JAVA_6_HOME = / System / Library / the Java / JavaVirtualMachines / 1.6.0.jdk / Contents / Home
    Export JAVA_7_HOME = / Library / the Java / JavaVirtualMachines / jdk1.7.0.jdk / Contents / Home
    Export JAVA_8_HOME = / Library / the Java / JavaVirtualMachines / jdk1.8.0.jdk / Contents / Home
    Export JAVA_HOME = $ JAVA_7_HOME
    · · ·
    3. create a command alias dynamic switching JAVA_HOME configuration
    · · ·
    alias = jdk8 'Export JAVA_HOME = $ JAVA_8_HOME'
    Alias JDK7 = 'Export large column  busy people jdk8, born later than the passion of several summer JAVA_HOME = $ JAVA_7_HOME'
    Alias JDK6 = 'Export JAVA_HOME = $ JAVA_6_HOME'
    · · ·

验证
min-xufpdeMacBook-Pro:~ min_xu$ java -version
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
min-xufpdeMacBook-Pro:~ min_xu$ vim .bash_profile
min-xufpdeMacBook-Pro:~ min_xu$ source .bash_profile
min-xufpdeMacBook-Pro:~ min_xu$ java -version
java version “1.8.0_101”
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
min-xufpdeMacBook-Pro:~ min_xu$ jdk7
min-xufpdeMacBook-Pro:~ min_xu$ java -version
java version “1.8.0_101”
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
min-xufpdeMacBook-Pro:~ min_xu$ source .bash_profile
min-xufpdeMacBook-Pro:~ min_xu$ java -version
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
min-xufpdeMacBook-Pro:~ min_xu$

Guess you like

Origin www.cnblogs.com/lijianming180/p/12325445.html