wood burning stoves*
The moose likes Applets and the fly likes Applet non-JDK packages import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet non-JDK packages import" Watch "Applet non-JDK packages import" New topic
Author

Applet non-JDK packages import

Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
Hello, friends!

I've got an applet that uses some packages that are not included in the standart JDK, I presume they're loaded through the plug-in that loads the applet. Anyway, what about some other packages... for instance org.apache.commons.httpclient and com.oreilly.servlet packages? How am I supposed to include them in the JAR that needs to be signed. I guess it's not by including the source within, there must be some other way. Would you assist me on that issue, please?

Thanks in advance! Best regards,

Martin Asenov
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
It's no problem to use other libraries in an applet - that's what the "archive" attribute of the applet tag is for. If the applet is signed, then all other jar files need to be signed as well; it works the same way.


Ping & DNS - my free Android networking tools app
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
Thanks, Ulf, I gave it a try... Everything's fine, the applet gets loaded, but... when it comes to using the HttpClient package from apache i get a ClassDefNotFoundError in the java console. But I've got the 'commons-httpclient-3.1.jar' in /WebContent and it is signed, and it does contain the class that 'could not be found'.

And that's my applet tag:



Please, help...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Are the other jar files being accessed and found correctly? Can you see (in the web server access logs) the request for the jar file coming it? If so, is the URL correct, and does the server respond with a 200 response code? Can you download the jar file manually through the browser?
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
Ok, Ulf, I fixed that. Anyway, if my applet is signed with certain keystore, and the relative jars that the applet uses are signed with another keystore, is the applet supposed to run?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
I doubt that you can use different keys, but that's easy enough to test.
 
Consider Paul's rocket mass heater.
 
subject: Applet non-JDK packages import