java - How to add an applet to a webpage -


i'm trying make applet website, can't put applet on website.

this html code

<html> <body> <p>test</p> <applet code="testcreator.class" width="400" height="400"> </applet> </body> </html> 

my applet code

package me.zachary.self;  import java.applet.applet; import java.awt.graphics;  import javax.swing.japplet;  public class testcreator extends japplet {      public void paint(graphics g) {         super.paint(g);         g.drawstring("test", 100, 100);     }  } 

the testcreator.class in same directory html file, whenever open html file appears "test" ("test" uppercase t, not "test" applet).

what doing wrong , / or how fix it?

thanks

i suggest read why cs teachers should stop teaching java applets.

i think

<applet code="testcreator.class" 

shouldn't end in .class. should include package. like,

<applet code="me.zachary.self.testcreator" 

and might find easier test applet appletviewer.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -