This is probably not officially supported, but I use this technique all the time for testing against different JDKs.
In ${install-dir}/config/asenv (or asenv.bat for Windows systems) is a line that assigns the path to the JDK to the variable AS_JAVA. My advice is to make a copy of the asenv file, then comment the existing line out (so you can fall back to it easily) and then add a new line - uncommented - pointing to the JDK you want GlassFish to use.
Note that this will work for any GlassFish-specific code, including the server and the asadmin commands. It does not have any effect on which Java runtime is used for Java Web Start.
- Tim
[Message sent by forum member 'tjquinn' (tjquinn)]
http://forums.java.net/jive/thread.jspa?messageID=221291