I'm trying to get appletviewer to work with a very simple Hello program. Here's my code for test.java
import java.applet.*;
import java.awt.*;
public class test extends Applet {
public void paint(Graphics g) {
g.drawString("Hello",123,125);
}
}
Then I wrote the following html. Here's my code for test.html
<applet code = "test" width = 300 height = 300>
</applet>
When I execute the command: appletviewer test.html Everything works great.
I run into trouble when I try add a package label at the top of my java file. Line #1 starts with:
package applet;
I find I can't get the appletviewer to work. I get an error that reads:
java.lang.NoClassdefFoundError: test (wrong name: applet/test)
From a book I'm reading (Core Jave, Volume I - Fundamentals) I see that I should change my html file as follows (adding applet/ before the name test):
<applet code = "applet/test" width = 300 height = 300>
</applet>
Now I get the error:
load: class applet/test not found.
I suspect my problem is in my html syntax but I can't figure it out. I've tried applet.test, applet//test and several others but nothing works. How can I get appletviewer to recognize my applet if it has a package name?