I have written a very basic applet, as I have only begun learning. This particular applet should only show some text, however whenever I run this locally (I have configured java to medium security) or from the server, I get the following error with no details:
RuntimeException Java.lang.InvocationTargetException
I have tried using Chrome, Firefox, IE but I get the same error message for all of them.
Here is my HTML:
<html>
<body>
<applet code="app.class" width="400" height="400"></applet>
</body>
</html>
Here is my java code:
import javax.swing.*;
import java.awt.*;
class app extends JApplet {
public void paint (Graphics g){
super.paint(g);
g.drawString("GIO", 15, 25);
}
}
This is where my applet is: http://testingsomestuff.netne.net/
Thank you for your help.
An applet has to be declared public
. So:
class app extends JApplet {
Should be:
public class app extends JApplet {
1) Please learn common Java naming conventions (specifically the case used for the names) for class, method & attribute names & use them consistently.
2) Ensure the Java Console is configured to show for applets & JWS apps. If there is no output at the default level, raise it and try again.
3) The code
attribute should be the FQN, not the file name, so:
<applet code="app.class" width="400" height="400"></applet>
Should be:
<applet code="app" width="400" height="400"></applet>