Attribute codebase
specifies the base URL of the applet – the directory that contains the applet’s code. It is used while searching jar files in archive
attribute, in such a way that all jars in archive
attribute are searched relative to codebase
.
So. When you use archive="http://myurl.com/archive/myjar.jar"
and codebase="http://myurl.com/classes"
together it means: find “http://myurl.com/archive/myjar.jar“ in “http://myurl.com/classes“ folder.
I.e. the full search path is “http://myurl.com/classes/http://myurl.com/archive/myjar.jar“. And of course it can’t be found!
Also, classes, whose jar-files aren’t specified in the archive
attribute, can’t be found without codebase
attribute. I.e. if there is no codebase
then there is no way to find your classes in “http://myurl.com/classes“ folder.
You can find more details in the Deploying With the Applet Tag tutorial.
I suggest the following solution:
- Place
myjar.jar
in thehttp://myurl.com/classes
folder; - Assuming your MyClass.class is in default package, and in the “http://myurl.com/archive/myjar.jar“, the following code should work:
<html>
<body>
<applet width=600 height=300 code="MyClass"
type="application/x-java-applet;jpi-version=6"
archive="myjar.jar"
codebase="http://myurl.com/classes">
no applet
</applet>
</body>
</html>