java.lang.UnsupportedClassVersionError: BallApplet : Unsupported major.minor version 51.0
That’s my error. I am just making a simple applet which moves a red ball across the screen.
The error is thrown in the browser. When I run in eclipse, it works fine.
Any ideas?
Here’s the source -
package applet_tut_one;
import java.applet.*;
import java.awt.*;
public class BallApplet extends Applet implements Runnable {
private static final long serialVersionUID = -6439819789183377101L;
int x_pos = 10;
int y_pos = 100;
int radius = 20;
public void init() {
}
public void start() {
@SuppressWarnings("unused")
Thread th = new Thread(this);
}
public void stop() {
}
public void destroy() {
}
public void paint(Graphics g) {
g.setColor (Color.red);
g.fillOval (x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
}
public void run() {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while (true) {
x_pos++;
repaint();
try {
Thread.sleep(20);
} catch (InterruptedException ex) {
}
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
}
}
}