SUN Java vs. MicroSoft Java plugin for the browser
Also see: java.lang.NoClassDefFoundError - javac: target release 1.1 conflicts with default source release 1.5
On this page we learned that compiling for target 1.1 on Java 1.5 and higher
causes troubles. The solution was:
# javac -O -target 1.1 -source 1.2 applet.java
If you want to run applets with the microsoft java virtual machine, you have
many limitations. Here are some errors with "solutions":
java.lang.NoSuchMethodError: java/util/Random: method nextInt(I)I not found
at Nauplius.
at Artemia.start
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
Solution:
import java.util.Random;
Random generator = new Random();
public int nextInt(int n) {
return (( generator.nextInt() + Integer.MAX_VALUE / 2 ) % n);
}
-or-
public int nextInt(int n) {
return (int)( Math.random() * (double)n);
}
java.lang.ClassNotFoundException: java.awt.image.BufferedImage
at com/ms/vm/loader/URLClassLoader.loadClass
at java/lang/ClassLoader.loadClassInternal
at Artemia.init
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
Solution: Don't use BufferedImage, but Image.
java.lang.NoSuchMethodError: java/lang/Math: method toDegrees(D)D not found
at Nauplius$NaupliusMove.makeangle
at Nauplius$NaupliusMove.run
at java/lang/Thread.run
Solution:
public double toDegrees(double a) {
double ret = a * 180.0 / Math.PI;
return ret;
}
java.lang.ClassNotFoundException: java.util.TimerTask
at com/ms/vm/loader/URLClassLoader.loadClass
at java/lang/ClassLoader.loadClassInternal
at Artemia.start
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
Solution: Don't user Timer/TimerTask, but Thread (threads work in most cases equally good).
java.lang.NoSuchMethodError: java/lang/Math: method toRadians(D)D not found
at Nauplius.<init>
at Artemia.start
at com/ms/applet/AppletPanel.securedCall0
at com/ms/applet/AppletPanel.securedCall
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
Solution:
public double toRadians(double a) {
double ret = a * Math.PI / 180;
return ret;
}
Last-Modified: Wed, 05 Jul 2006 20:44:30 GMT