• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

jar file

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I build a jar file called "A.jar", to invoke my applet from.
In one of ".class" file, I have imported a class which is in a jar file say "B.jar", if I include B.jar in A.jar the class which uses the class which is in B.jar throws an exception cannot find the class.
I am new to applet any help is welcome.
Thank you
Garandi
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
U need to give Class-Path:B.jar in manifest file of A.jar. And try it out.Location of B.jar is relative path of A.jar.
 
Karan V Praba
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't add B.jar into A.jar.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Garandi,
Although you can nest JAR files (i.e. package one JAR file inside another), java doesn't know how to handle nested JAR files (as you have seen ;-)
In order to overcome your problem, you have several options -- one of which has already been mentioned by Karan (namely, using the "Class-Path:" header of the JAR manifest file).
Another option would be to build a new JAR file that contains all the classes from "A.jar" and "B.jar" (if that's feasible for you).
Note that the <APPLET> tag has an ARCHIVE attribute that can take a list of JAR files. Here is a quote from the relevant javadoc:
http://java.sun.com/j2se/1.4.1/docs/guide/misc/applet.html


ARCHIVE = archiveList
This OPTIONAL attribute describes one or more archives containing classes and other resources that will be "preloaded". The classes are loaded using an instance of an AppletClassLoader with the given CODEBASE.
The archives in archiveList are separated by ",".


So you could list both "A.jar" and "B.jar" in your archive list.
Hope this has helped you.
Good Luck,
Avi.
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Karan and Avi thanks for reply.
Garandi
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic