applet class not found - codebase problem?
Hi,
I'm having problems displaying an java applet in a html file with the following code
<html><body><center><applet code="MyApplet" codebase="/home/msc2005/username/public_html" width="420" height="280"><p> </p>Sorry, your browser does not support applets</applet></center></body>
</html>
where both the html file and the applet are in the /home/msc2005/username/public_html directory on the server.
I keep getting a class not found exception. The java concole says it is caused by IOException : open http connection failed.
I understand from reading other posts that a get request is sent to the path specified in the codebase attribute where it then finds the applet class file, but I've tried various combinations of the file path, I've even tried the URL of the applet (http://csservsr/~username/public_html) but still no success. Perhaps the problem is not with the codebase attribute at all. I wouldn't mind but this same code worked previously without any codebase but the stopped working :confused:
Any help would be much appreciated
[1184 byte] By [
hugh] at [2007-11-11 8:48:35]

# 1 Re: applet class not found - codebase problem?
If both are in the same folder, don't even worry about the codebase variable. And, well I'm not applet expert, should code equal "MyApplet.class" ?
# 2 Re: applet class not found - codebase problem?
Thanks for your reply Phaelax,
Originally I did not specify the codebase and it worked ok, I didnt look at the website for a few weeks and when I looked at it again it wasnt working. I then tried including the codebase (as well as other things) to try to get it working again, but nothing seems to work.
I think you are right, because the are in the same folder I dont have to worry about the cobebase. I also tried MyApplet.class for the code attribute (as you suggested) but once again, no luck.
I have since viewed the site on several browsers and found that the applet works fine on Mozillla and displays the "your browser does not support applets" message on Konkeror. So it seems the problem is only with Internet Explorer (I'm using version 6). Do you know of any reason why Internet Explorer should not support applets, I've played about with the internet options but maybe I'm missing something.
hugh at 2007-11-11 22:35:16 >

# 3 Re: applet class not found - codebase problem?
Try adding this to your applet's init() method and see if that fixes any IE issues.
JRootPane rootPane = this.getRootPane();
rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
# 4 Re: applet class not found - codebase problem?
Hi Phaelax,
I tried JRootPane as you suggested but I'm still getting the same problem. I checked the java console and its still saying it cannot find myApplet.
Also, I may have spoken too soon on my last post.
I went to an internet cafe yesterday and tried my site on several browsers and the applet didn't work on any of them. In fact the only time my applet works is when I right click on the html file and select "open with mozilla". But when I view the html file with a browser I get the problem. I therefore jumped to the conclusion that it works fine on mozilla but not on IE6 but it may have more to do with the way I view the file (http connection to a browser versus right click and open with a browser)
This is a complete mystery to me, I really appreciate your help as I would like to write the URL of my site on my resume (looking for a job at the moment) but I can't as long as this problem persists.
hugh at 2007-11-11 22:37:25 >

# 5 Re: applet class not found - codebase problem?
i have a applet class located in a jar within the package "de.graviton.lettersalad.view".
All bundled in a jar. the following works fine:
<applet archive="lettersalad.jar" code="de.graviton.lettersalad.view.AppletMain.class" width="550" height="300" codebase="http://narcanti.keyboardsamurais.de/wp-content/">
</applet>
perhaps you should try to add the ".class" filename extension for your applet into the code attribute.
# 6 Re: applet class not found - codebase problem?
Thanks for your reply gravition, but I've sorted it out now. I didn't have the proper file permissions set on my applet (embarrassing)
hugh at 2007-11-11 22:39:23 >
