图片:

显示版本的命令提示符

错误图片

Hello.java

import java.applet.Applet;
import java.awt.*;

public class Hello extends Applet {

    // Java applet to draw "Hello World"
    public void paint (Graphics page) {
        page.drawString ("Hello World!", 50, 50);
    }
}

Hello.html

<HTML>
    <HEAD>
        <TITLE>HelloWorld Applet</TITLE>
    </HEAD>

    <BODY>
        <APPLET CODE="Hello.class" WIDTH=300 HEIGHT=150>
        </APPLET>
    </BODY>
</HTML>

错误

Hello : Unsupported major.minor version 52.0

可能是什么问题?


当前回答

只需访问http://java.com/en/download/并更新您的JRE版本

其他回答

如果JDK版本正确。另一个可能导致这个错误的原因是你的Android Studio版本太低了,而你的Gradle版本太高了。将IDE升级到新版本可能会有所帮助。

如果你正在使用IntelliJ IDEA,进入项目结构(Ctrl + Alt + Shift + S),你可以改变项目的JDK。

如果您正在使用Eclipse,请确保您的菜单Project→Properties→Java构建路径→libraries→JRE系统库符合您的项目需求(如图所示)。

如果您使用的是Eclipse v4.4 (Luna),并且已经完成了上面提到的所有步骤,那么您可能需要检查Run Configurations设置。

可能有几种可能导致此错误。根本原因是需要在JDK1.8/JRE8中编译的项目不匹配,而环境编译器是JDK1.7/JRE7。

你可以查看我的博客文章,看看你的设置是否正确。

您必须使用相同版本的Java运行和编译应用程序。

如果你正在使用Eclipse,你应该做两件事:

In Eclipse, click on "Window > Preferences", and in the window that appears, on the left side, under "Java", click on "Installed JREs", click on "Add..." and navigate to the folder that contains the JDK. Right-click on your project and click on "Properties", in the window that appears, on the left side, click on "Java Compiler" and uncheck "Use compliance from execution environment on the Java Build Path", this allows you to choose in the the list "Compiler compilance level" the same version that you set in the previous step.