error could not find the main class program will exit after netbeans

 ̄綄美尐妖づ 提交于 2020-01-06 07:55:09

问题


When i compile and run my program in eclipse, it works. When i run my .jar program on my personal computer (Windows 8 with java JDK 7), it works. But when i'm trying to run .jar in others computers, it doesn't work.

So i tried to run with command line java -jar myjar and i got this message which i can't understand

java -jar "Bureau\Application SNCF\SNCF.jar"

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file

    at java.lang.ClassLoader.defineClass1(Native Method)
    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$100(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)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Does anyone understand this message error? Thanks for your help


回答1:


This is always caused by the conflict of different Java JDK at compile time and runtime, make sure you are using same JDK version to compile and run it.



来源:https://stackoverflow.com/questions/14621047/error-could-not-find-the-main-class-program-will-exit-after-netbeans

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!