MAC系统查看自己的java位置

打开命令行工具

which java

/usr/bin/java

ls -l /usr/bin/java

lrwxr-xr-x 1 root wheel 74 12 3 2015 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

ls -l /System/Library/Frameworks/JavaVM.framework/Versions

drwxr-xr-x 8 root wheel 272 12 3 2015 A
lrwxr-xr-x 1 root wheel 1 12 3 2015 Current -> A

java -version 

java version “1.8.0_40”
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

定位JAVA_HOME

/usr/libexec/java_home

/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home

cat ~/.profile  
		JAVA_HOME=`/usr/libexec/java_home`  
		export JAVA_HOME 

 

echo $JAVA_HOME  

/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home

/usr/libexec/java_home -V  


This entry was posted in JAVA, MAC and tagged , , . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/mac-java-where/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

  

  

About Me

静水流深,水滴石穿