使用IntelliJ idea新建工程时需要查看jdk安装目录,记录下来为以后备用。

mac自带jdk,查看jdk版本:

IcarusdeMacBook-Pro:~ icarus$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

查看jdk安装目录:

IcarusdeMacBook-Pro:~ icarus$ /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
    1.8.0_144, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

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

  最后一行/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home即是jdk目录,填入到IntelliJ idea相应位置即可。