Exception in thread “main” java.lang.UnsupportedClassVersionError: com/crunchify/Main : Unsupported

来源:互联网 发布:程序员一天工作几小时 编辑:程序博客网 时间:2024/06/06 03:30

https://crunchify.com/exception-in-thread-main-java-lang-unsupportedclassversionerror-comcrunchifymain-unsupported-major-minor-version-51-0/

完美解决!!!!

Recently I faced this wired exception while running my Java application on Linux environment.

The only difference I noticed in about Java Version. I compiled all code on my laptop with version 7 and Linux had version 6. java.lang.UnsupportedClassVersionError happens because of a higher JDK during compile time and lower JDK during runtime.

Now how to solve it?

  1. Project -> Properties -> Java Compiler
  2. Enable project specific settings.
  3. Then select Compiler Compliance Level to 1.6 or 1.5, build and test your app.

Crunchify-Tips-Fix-Javaa-Compiler-Major-Minor-Version

And that’s all.

The version numbers mentioned above are the version of the JRE the class file is compatible with. There is another way to fix this problem – try bundling your own required JVM with your application and set JAVA_HOME from your startup.shscript.

Would love to know what you think. Chime in and share it as a comment. Don’t forget to share this guide!
阅读全文
0 0
原创粉丝点击