aspose file tools*
The moose likes Applets and the fly likes Applet can't find JDOM classes, how to solve this? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet can Watch "Applet can New topic
Author

Applet can't find JDOM classes, how to solve this?

Mouza Ali
Ranch Hand

Joined: Oct 28, 2008
Posts: 39
Hi

I'm using JDOM to create XML file in an Applet class, but it seems that the
Applet can't find the JDOM classes. I searched the web and found that something has to do with the JDOM jar file, but couldn't find clear explanation. Can anyone help me to resolve this issue?

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41889
    
  63
Post your applet tag. It needs to have an archive attribute that points to the jar file, and the jar file needs to be publicly accessible - I'd put it in the same directory as the HTML/JSP file that contains the applet tag.

I'll move the topic to the Applet forum.


Ping & DNS - my free Android networking tools app
Mouza Ali
Ranch Hand

Joined: Oct 28, 2008
Posts: 39
Hi, thanks.

the tag initially was like this:
<applet code="CApplet.class" width="500" height="200"></applet>

Then change it to:
<applet code="CApplet.class" Archive="jdom.jar" width="500" height="200">
</applet>

This jdom jar is the one i downloaded from the Internet and then imported it in the project libraries..

but the error is the same!

While searching the net, I found that i may have to import one jar file that will integrate the applet and the jdom, is that right? or I should create another jar file so whenever the jdom is imported in the applet, it will be imported from the java jdk jar files, not the jdom real one..

I don't think I got the idea clear, and there aren't many posts on the net about this issue.

Can anyone help me with this , and I'll appreciate that.

Thanks in advance for the Applet forum.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41889
    
  63
There's nothing you need to do with the jar file, nor do you need any other jar file.

The attribute is named archive, not Archive; you should fix that.

Where does the jar file live relative to your HTML file? You talk about "project libraries" - that makes me think you're using an IDE. That often doesn't work so well for running applets. Try running the HTML directly in the browser, and keep the jar file in that directory as well.
Mouza Ali
Ranch Hand

Joined: Oct 28, 2008
Posts: 39
Hello again,

thanks. I changed the Attribute to "archive", but the error is the same. The jdom jar file resides in the home directory where the applet and the index file are both under webapps under apache under the root directory. I tried copying the jdom file into the same directory of the applet using the "sudo" command, but whenever there is changes in the eclipse, it disapears from there and can't make the link.

do you have any idea of what is going on there and how to solve this?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41889
    
  63
I'm not sure what Eclipse is doing, but if it's causing problems then I'd start by running the applet in the browser without Eclipse running at all.
Mouza Ali
Ranch Hand

Joined: Oct 28, 2008
Posts: 39
hello..

the problem has been solved successfully

thanks
 
wood burning stoves
 
subject: Applet can't find JDOM classes, how to solve this?