错误找不到主类程序会在netbeans后退出 [英] error could not find the main class program will exit after netbeans

查看:126
本文介绍了错误找不到主类程序会在netbeans后退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在eclipse中编译和运行我的程序,它的工作原理。
当我在我的个人计算机上运行我的.jar程序(Windows 8与java JDK 7),它的工作原理。
但是当我试图运行.jar在其他电脑,它不工作。

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.

所以我试图运行命令行 java -jar myjar
,我收到了我不能理解的消息

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

推荐答案

这总是由不同Java JDK在编译时和运行时的冲突,请确保您使用相同的JDK版本来编译和运行它。

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.

这篇关于错误找不到主类程序会在netbeans后退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆