--Environment - Windows10 64bit - GlassFish : 4.1.2
I was angry when I tried to launch GlassFish.
$ /c/app/glassfish-4.1.2/glassfish4/glassfish/bin/asadmin
java.lang.UnsupportedClassVersionError: org/glassfish/admin/cli/AsadminMain : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.glassfish.admin.cli.AsadminMain. Program will exit.
Exception in thread "main"
This is because the “jar” is compiled with JDK 1.7, but you try to run in a JDK 1.6 environment. Java : Unsupported major.minor version 51.0
I didn't run the jar ... I thought, and when I opened asadmin.bat, the jar was running properly.
REM Always use JDK 1.6 or higher
REM Depends on Java from ..\config\asenv.bat
VERIFY OTHER 2>nul
setlocal ENABLEEXTENSIONS
if ERRORLEVEL 0 goto ok
echo "Unable to enable extensions"
exit /B 1
:ok
call "%~dp0..\config\asenv.bat"
if "%AS_JAVA%x" == "x" goto UsePath
set JAVA="%AS_JAVA%\bin\java"
goto run
:UsePath
set JAVA=java
:run
%JAVA% -jar "%~dp0..\lib\client\appserver-cli.jar" %*
Java at that time was ...
$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
Is it because of your mind? I feel like it says Always use JDK 1.6 or higher
in asadmin.bat.
I changed JAVA_HOME to 1.8. If you cannot switch Java successfully on Windows 7, please refer to here.
$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Try to start GlassFish again.
$ /c/app/glassfish-4.1.2/glassfish4/glassfish/bin/asadmin start-domain domain1
Attempting to start domain1.... Please look at the server log for more details.....
The message I was expecting was ``` Command start-domain executed successfully.` `` It wasn't like, so I couldn't start it: I was impatient with: interrobang :, but when I looked at http: // localhost: 4848, it started. It was.