I'm doing a project in IntelliJ with GlassFish and it throws this error:
GlassFish requires Java SE version 6. Your JDK is version 0.
I ran the glassfish4/bin/asadmin start-domain
command in a terminal but still get the same error.
I do have Java SE installed, SDK version 8u152 (I checked on Java Panel). Also, I don't know why it searches for jdk 9.
“GlassFish requires Java SE version 6. Your JDK is version 0” I'm trying to use Glassfish on a Mac running 10.15.6 Catalina. When I run the command, "GlassFish requires Java SE version 6. Your JDK is version 0" Numerous posts online said to add to the file "asenv.conf," a path to the JDK, such as
This release supports JDK 11. The latest stable release for Eclipse GlassFish 6.1. It is functionally complete and meets the compatibility requirements of the approved final version of the Jakarta EE 9.1 Specification. Downloads are provided for both Jakarta EE Platform 9.1 and Jakarta EE Web Profile 9.1.
(This was for a Swing application, where the users only had Java 5 installed.) Apparently when Glassfish is installed it hard-codes its reference to your JDK location, so to fix this problem I ended up having to edit a file named asenv.bat.
Eclipse GlassFish 6.1 is targetted to be a Compatible Implementation of Jakarta EE 9.1. Note this release requires JDK 11. The final release is scheduled to coincide with the final release of Jakarta EE 9.1.
For me java home was good, the only issue was that the version was not matching up.
Open “glassfish -> config -> asenv.conf”. Add the line AS_JAVA=PATH_TO_YOUR_JDK_DIRECTORY
The only stuff needs to be kept in mind is AS_JAVA=PATH_TO_YOUR_JDK_DIRECTORY should exactly match with the jdk version you mentioned in your intellij.
Now ->
C:\Program Files\Java\jdk1.8.0_40 is mentioned in intellij... file-> SDK's set AS_JAVA=C:\Program Files\Java\jdk1.8.0_40 is mentioned in glassfish -> config -> asenv.conf
Which me, open asenv.conf
in PATH_TO_YOUR_GLASSFISH/glassfish/config
folder, go to end of lines and add set AS_JAVA=/PATH_TO_YOUR_JAVA/Java/JavaVirtualMachines/jdk-YOUR-VERSION.jdk
I tried all these approaches and none worked for me.
All answers talk about going to folder PATH_TO_YOUR_GLASSFISH/glassfish/config
and then editing asenv.conf
.
Editing that file didn't have have any effect.
I did go to that folder but ended up editing asenv.bat
.
I literally added this to the end: set AS_JAVA=../../../../Program Files/Java/jdk1.8.0_261
The generic instruction would be: set AS_JAVA=PATH_TO_YOUR_JDK
Note: the asenv.conf
file has quotes around values, asenv.bat
does not.
I finally tracked the answer down from this question:
How do I specify the JDK for a GlassFish domain?
Go to folder '..\GlassFish-4.1.2\glassfish4\glassfish\config'.
Open in Notepad: asenv.bat
Add in end row:
set AS_JAVA=....\Java\jdk1.8.0_291
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With