javawindowsglassfish-3

Run Glassfish on Java 7 with Java 8 installed on Windows box


I am working on a legacy project with Glassfish 3 and Java 7. The problem is in order to run Eclipse, I need Java 8. When I install Java 8, I can no longer run Glassfish under Java 7 for some reason.

I do see the two JDKs in control panel for User tab in Java Runtime Environment Settings, but under System once I install Java 8, I only see Java 8 there. So it just runs under Java 8 from what I can tell.

This is my first week of Java.


Solution

  • Simply specify the needed JDK for your Glassfish domain:

    1. Find this configuration file: C:\servers\glassfish\config\asenv.bat (this path is an example)
    2. Edit the file, comment the previous JDK and add the wanted one:

      REM set AS_JAVA=C:\Program Files\Java\jdk1.8\.. 
      set AS_JAVA=C:\Program Files\Java\jdk1.7\..