Inside one of my Netbeans projects, as jar is built and run perfectly. However, when the same project is cleaned & built, the lib
folder is absent from dist
and the generated jar
does not run and produces the following CMD prompt message:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>CD C:\Users\gurukripa\Documents\NetBeansProjects\I-ROOM\dist
C:\Users\gurukripa\Documents\NetBeansProjects\I-ROOM\dist>java -jar iroom.jAR
Unable to access jarfile iroom.jAR
C:\Users\gurukripa\Documents\NetBeansProjects\I-ROOM\dist>java -jar I-ROOM.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: i/room/Essent
ials (Unsupported major.minor version 51.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
C:\Users\gurukripa\Documents\NetBeansProjects\I-ROOM\dist>
I am using:
When I double-click on the jar nothing happens, but I can see javaaw
is running in task manager. Is there a valid reason for this?
Your JAR was compiled with a different version of the JDK than the one you are trying to use to run it. Ensure that both Netbeans and command line are using the same version of the JDK.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.