我安装了带有Java 8的Mac Mini。在命令shell中,如果设置了JAVA_HOME,则所有java命令都会无限期挂起。
任何人都知道这是为什么以及如何解决它?
$ uname -a
Darwin myhostname 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
$ set | grep JAVA_HOME
### no output - JAVA_HOME is not set ###
$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
$ which java
/usr/bin/java
$ ls -l /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Jan 8 2015 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions/Current/bin
lrwxr-xr-x 1 root wheel 8 Jan 8 2015 /System/Library/Frameworks/JavaVM.framework/Versions/Current/bin -> Commands
$ /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/Current
$ java -version
### hangs here ###