1
votes

I was trying to make a web application. I generated maven web app using NetBeans 7.0.1. And when I try to open this app through Intellij Idea I have following exception. Can someone to explain what could be the problem.

C:\glassfish-4.0\glassfish4\glassfish\bin\asadmin.bat start-domain --debug domain1 Detected server admin port: 4848 Detected server http port: 8080 [2014-01-05 12:05:55,093] Artifact mobiles:war exploded: Server is not connected. Deploy is not available. 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(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: org.glassfish.admin.cli.AsadminMain. Program will exit. Exception in thread "main"

1
I found solution. If someone will have the same problem here is solution. it is due to the default version in the system is JDK6, but the error is undescriptive and it should be somthing like "Unsupported JDK version, use JDK7 version.". when adding the following line to asenv.bat set AS_JAVA=C:\Program Files\Java\jdk1.7.0_17 - user3127896

1 Answers

2
votes

The error message

Unsupported major.minor version 51.0

shows that you try to use code compiled with JDK7 but your target JDK doesn't support version 7 (so its probably a JDK6 or lower). Glassfish 4 is the reference implemenation of Java EE 7 so it needs JDK7 or higher.

See also: