I have tried everything. I am using 000webhost to test the applet. So I uploaded the java file
package game;
import java.applet.*;
import java.awt.*;
public class main extends Applet implements Runnable
{
int x_pos = 10;
int y_pos = 100;
int rad = 20;
public void init()
{
setBackground (Color.blue);
}
public void start()
{
Thread th = new Thread (this);
th.start();
}
public void stop()
{
}
public void destroy()
{
}
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);
}
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.fillOval(x_pos - rad, y_pos - rad, 2*rad,2*rad);
}
}
to the server. I checked the hex code and the first 4 bit digits were CAFEBABE. Then the Html was
<head>
<h1 align = "center">Test</h1>
</head>
<body>
<applet code = "game.main" archive = "main.java" width = "40" height = "40">
</applet>
</body>
</html>
Any ideas why I get the Incompatible magic value 1008813135 in class file error?