I've been able to run applets from html pages, but I have trouble when the source code is part of a package. Assume that :
1. classpath = C:\cpdir 2. code has no package statement. 3. code is compiled in C:\cpdir\subdir 4. raw html (below) is run through an html converter and then saved into C:\cpdir\subdir 5. jar file created in C:\cpdir\subdir via jar -cf MyClass.jar *.class 6. then all class files deleted
My first guess is that your jar file is not created fine in second case. Note that you have included the package statement in your class in second case. So, when you open your jar file ( you can use winzip to open it) you should see subdir in path column for Myclass.class file.
Just try the following. Instead of creating jar file from c:\cpdir\subdir as jar file created in C:\cpdir\subdir via jar -cf MyClass.jar *.class
create it as:
jar file created in C:\cpdir via jar -cf MyClass.jar subdir\*.class
This will place MyClass.class file under subdir path, so MyClass full-qualified name will be subdir.MyClass.