How do I specify the JDK for a GlassFish domain?
Here you can find how to set path to JDK for Glassfish: http://www.devdaily.com/blog/post/java/fixing-glassfish-jdk-path-problem-solved
Check
glassfish\config\asenv.bat
where java path is configured
REM set AS_JAVA=C:\Program Files\Java\jdk1.6.0_04\jre/..
set AS_JAVA=C:\Program Files\Java\jdk1.5.0_16
I'm working on a Mac, OSX 10.9. I recently had to update my JDK to 1.7 for some VPN software. The application I'm working runs on JDK 1.6, so a GlassFish had to run with JDK 1.6. It took a minute to iron this out, but here's how it went for me. I work with the NetBeans IDE by the way.
My GlssFish configuration file
/Applications/NetBeans/glassfish-3.1.2.2/glassfish/config/asenv.conf
Path to JDK 1.6
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
I added the following line to the bottom of my
asenv.conf
fileAS_JAVA=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
Adding the actual content from dbf's link in order to keep the solution within stackoverflow.
It turns out that when I first installed Glassfish on my Windows system I had JDK 6 installed, and recently I had to downgrade to JDK 5 to compile some code for another project.
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. In short, I edited this file:
C:\glassfish\config\asenv.bat:
and I commented out the reference to JDK 6 and added a new reference to JDK 5, like this:
REM set AS_JAVA=C:\Program Files\Java\jdk1.6.0_04\jre/..
set AS_JAVA=C:\Program Files\Java\jdk1.5.0_16
Although the path doesn't appear to be case sensitive, I've spent hours debugging an issue around JMS Destination object not found due to my replacement path's case being incorrect.