MyEclipse中could not find the main class. Program will exit.问题

在MyEclipse中运行任何控制台的程序JVM都会出现上述问题,并报如下错误:
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)
Exception in thread "main" 
解决办法
确认JAVA编译器和JRE版本一致,在Myeclipse中
右键点击项目--->>>preference-->>>JAVA compiler  查看编译器版本
右键点击项目--->>>build path--->>>Configure build path--->>>Libraries-->>JRE system library  查看JRE版本
如果不一致,修改成一样即可



欢迎关注公众号:Java后端技术全栈