Last active
May 14, 2019 02:30
-
-
Save ponsuke0531/07ece6527eb7949174845a577614b89a to your computer and use it in GitHub Desktop.
MacでJavaのバージョンを切り替える方法 ref: https://qiita.com/ponsuke0531/items/795cd00d93b71c14d07b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ java -version | |
java version "1.8.0_45" | |
Java(TM) SE Runtime Environment (build 1.8.0_45-b14) | |
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home -V | |
Matching Java Virtual Machines (5): | |
1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home | |
1.8.0_45, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home | |
1.7.0_67, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home | |
1.6.0_65-b14-468, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home | |
1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home | |
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo vi .bashrc | |
Password:{パスワード} | |
---ここからviエディタ------------------------------------------ | |
<ここにはズゥっと前に書いた設定が書かれています> | |
export JAVA_HOME=`/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home -v "1.7"` | |
PATH=$JAVA_HOME/bin:$PATH | |
---ここまでviエディタ------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ source ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ java -version | |
java version "1.7.0_67" | |
Java(TM) SE Runtime Environment (build 1.7.0_67-b01) | |
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment