在MacOS JDK11下安装带有JDK8的GlassFish5

时间:2019-02-23 22:39:59

标签: java macos glassfish java-11 glassfish-5

需要在MacOS上运行GlassFish5。安装的当前版本为JDK11.02和JDK1.8.0_144。

>echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home

>which java
/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java

>java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

我在文件glassfish5/bin/asenv.bat的最后一行附加了     AS_JAVA=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

启动GlassFish时,我仍然收到NPE异常:

>asadmin start-domain
Exception in thread "main" java.lang.NullPointerException

我想念什么?

还是无法在具有JDK11的MacOS上运行带有JDK 8(u144)的GlassFish?

1 个答案:

答案 0 :(得分:0)

您需要在AS_JAVA中设置asenv.bat,而不是在AS_JAVA中设置glassfish5/config/asenv.conf变量。

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