This question already has an answer here:
Pictures:
Command Prompt showing versions
Picture of error
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>
Error
Hello : Unsupported major.minor version 52.0
What may the problem be?
All you need to do to solve the problem is... to make sure your version of Java is the same for both compiling and running. No matter what tools or IDEs you are using.
You may want to check your Run Configurations setting if you're using Eclipse v4.4 (Luna) and have already completed all steps mentioned above.
There could be several possibilities that cause this error. The root cause is a mismatch of the project require compilation in JDK1.8/JRE8 while the environment compiler is JDK1.7/JRE7.
You can check my blog post to go through all your settings are correct.
If you are using IntelliJ IDEA, go to Project Structure (Ctrl + Alt + Shift + S), and you can change your project's JDK.
Just want to add this. I had this problem today. Adjusted the settings in my project, rebuilt, and same problem. I had (incorrectly) assumed that changing the settings in my project (Eclipse) would cause the projects on which my project depends to be recompiled also. Adjusting the settings to all of the projects up the dependency tree solved the problem.
This occurred to me when I installed a fresh Java 1.8, but left the old command line interpreter open.
It had an old path and kept on executing the application with Java 1.7 whereas project was already built with Java 1.8.
If you have a problem in Android Studio and you have installed Android N, change the Android rendering version with an older one and the problem will disappear.