File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes packages in applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "packages in applets" Watch "packages in applets" New topic
Author

packages in applets

Andrew Cho
Ranch Hand

Joined: Jun 29, 2011
Posts: 50
Hey all,
I have a question about external java libraries. I have applets that use other java libraries (PDFBox, SQL server drivers, etc.), and what I do is put the Binary code in the jar file with the applet that the HTML page calls. This makes the applet take forever to load because the jar file becomes huge. I know that this is wrong but how else can you do it? For some reason setting classpaths doesn't work for me.

Thanks,
Andrew
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18988
    
    8

You use the "archive" attribute of the <applet> tag. Here's a link to a tutorial: http://download.oracle.com/javase/tutorial/deployment/applet/html.html.
Andrew Cho
Ranch Hand

Joined: Jun 29, 2011
Posts: 50
Thanks Paul,
I actually am already using archive to access the .jar file that contains my applet class and its supporting files. I'm just wondering if I can use archive in the applet tag to access my applet, and have that access a different jar file outside of the jar that contains my applet.
So let's say I have MyApplet.jar and MySupportFiles.jar. If they are in the same directory, and my HTML page accesses the MyApplet.jar with the archive attribute, could it then use classes that are in MySupportFiles.jar?

Thanks again,
Andrew
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18988
    
    8

The archive attribute should list all the jars required. Including the applet itself, of course.
Andrew Cho
Ranch Hand

Joined: Jun 29, 2011
Posts: 50
Oh so you can use the archive attribute to access more than one .jar file?
I did not know that.
Would it just look like
?

Thanks,
Andrew
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18988
    
    8

No, of course not. It's an attribute.

Here's some documentation for you to read: http://htmlhelp.com/reference/html40/special/applet.html.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

Moving to our Applets forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Andrew Cho
Ranch Hand

Joined: Jun 29, 2011
Posts: 50
Ok, Thank you guys
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: packages in applets