Java 不支持的主要次要版本 52.0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23249331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java unsupported major minor version 52.0
提问by
I can not launch my java application as a web applet in HTML (I am using HTML 4.01, I know it doesn't work in html5). The error message it returns is:
我无法将我的 Java 应用程序作为 HTML 中的 Web 小程序启动(我使用的是 HTML 4.01,我知道它在 html5 中不起作用)。它返回的错误信息是:
java : Unsupported major.minor version 52.0
java:不支持的major.minor版本52.0
I have tried downgrading my java JRE/JDK/SDK but I still get the same error message. The current version of java I am now using is 1.8.0_05.
我尝试降级我的 java JRE/JDK/SDK,但我仍然收到相同的错误消息。我现在使用的 Java 的当前版本是 1.8.0_05。
采纳答案by Leonard Brünings
Your code was compiled with Java Version 1.8 while it is being executed with Java Version 1.7 or below.
您的代码是用 Java 1.8 版编译的,而它是用 Java 1.7 版或更低版本执行的。
In your case it seems that two different Java installations are used, the newer to compile and the older to execute your code.
在您的情况下,似乎使用了两种不同的 Java 安装,较新的用于编译,较旧的用于执行代码。
Try recompiling your code with Java 1.7 or upgrade your Java Plugin.
尝试使用 Java 1.7 重新编译您的代码或升级您的 Java 插件。
回答by MTom
I noticed that in netbeans Apache configuration in the servers tab. you can state the platform for your web application. I changed to 1.8 and it worked fine. (I am targeting java 8 platform in my application). Hope that might t help.
我注意到在服务器选项卡中的 netbeans Apache 配置中。您可以声明您的 Web 应用程序的平台。我改为 1.8 并且运行良好。(我在我的应用程序中针对 java 8 平台)。希望这可能没有帮助。
回答by Denis Kutlubaev
回答by jigzat
I assumed openjdk8 would work with tomcat8 but I had to remove it and keep openjdk7 only, this fixed the issue in my case. I really don't know why or if there is something else I could have done.
我认为 openjdk8 可以与 tomcat8 一起使用,但我不得不删除它并只保留 openjdk7,这解决了我的问题。我真的不知道为什么或者是否还有其他我可以做的事情。