Loading jars inside jars

I'm currently building a console launcher that automatically fetches the console UI classes from servers and then caches them to client machine. User can then launch console UIs of different kinds of servers using unified launcher.
My problem is that most of the console UIs are dependant of other libraries and extracting these libs inside the UI jar is not an option. I've tried to package all jars including the console UI application itself into a another jar but hitting the wall currently when I try to accomplish something like this:
1. Check if disk cache already contains the jar file with md5
2. If not fetch the jar to disk
3. Open the jar file
4. Fetch all jars inside the jar and pass them to new classloader from classloaderpool <- This is where i hit the wall as I can't figure how to make the classloading of jars inside another jar.
It seems that i can't create JarFile instances from inputstreams but only from specified filenames.
I tried to use uberjar from codehaus but couldn't figure how to instantiate the main class of the console ui with parameters from inside another application.

I suddenly find myself with a similar problem. My app is deployed with webstart, but I need to put a jar file in there (edtftpj-1.3.2.jar) so it can use FTP. Where do I put it? Right now it's inside a lib directory, but it's not getting found by the app that calls it.
Help?
--- Eric

Similar Messages

  • JARs inside my JAR

    Hi Folks,
    I'm creating a JAR file for my application. My app uses another JAR file and I want to package it inside my jar.
    I tried to use "Path-Class" attribute in MANIFEST.MF file but without success.
    Any help would be appreciate.
    TIA.
    Romualdo Rubens de Freitas

    I wonder how you missed to recognize that jars DO contain jars for four years, as you subscribed in 2001.
    Of course the standard class loader cannot handle jars in jars, but many solutions do exist for this problem. (It was really a problem, since almost all java applications are required to ship with jars inside jars).
    The best solution I encountered, is the fat_jar plugin for eclipse. If you are not an eclipse user try ONEJar.
    Being silent is sometimes better than to provide non-solutions for problems for which solutions exist.

  • Using resources from an external JAR inside a JAR

    Hi,
    I'm trying to package all parts of my application into a JAR file so I can deploy my application using Java Web Start. However, I have an issue.
    I need to use the files from an external JAR, Ice.jar, with my application. Therefore, I included Ice.jar in my build, specifically in the lib/Ice.jar directory.
    This does not seem to be working; my application cannot read the information from the Ice.jar file when I launch my JAR file. It does work in one instance, however:
    I have a directory included in the same directory where my JAR file is. This directory is named lib, and contains Ice.jar. My directory structure is as follows:
    dist
    dist/NVAC.jar //my JAR
    dist/lib/Ice.jar //the external JARMy JAR file, NVAC.jar, will ONLY work if that lib directory is included in its directory. This is NOT what I want to do; I want to include the external JAR inside my JAR file, so a user will only have to download the JAR file. I have included the external JAR inside my JAR as I mentioned previously; at the path myJAR/lib/Ice.jar.
    Therefore, how do I use a resource from an external JAR inside my JAR? Do I have to use ClassLoader? ClassLoader.loadClass() perhaps?
    If I can provide any more information, please let me know.
    Thanks

    Seems to me it isn't practical to want to do things
    that don't work. Especially since you're using
    WebStart and it takes care of dependent jars
    automatically for you if you configure things
    correctly, so this absurd idea of jars inside jars
    isn't even helpful.Dang DrClap, you seem to be the go-to guy for destroying all my ridiculous ideas (no offense; I mean that in a good way).
    Seems I did not understand JWS fully when I thought of that idea. I researched it more after reading the replies here, and I see that I was indeed thinking absurdly.
    Thank you for the help,
    Dan

  • Unable to load classes from jar files inside APP-INF/lib in EAR.

    Weblogic version: 10.3.3
    Platform: Linux x86-64 bit
    We deployed an ear packaged with all the common library jars inside APP-INF/lib. Deployment was successful.
    for some reason, it is always giving ClassNotFoundException for the classes inside the jars. This does not happen
    in 10.3.2 version of weblogic.
    We tried to add them to domain/lib directory (instead of APP-INF/lib) but still it is not able to resolve the classes.
    Any pointers would be appreciated.

    try using prefer-web-inf-classes in the weblogic.xml file in your WAR file
    or using prefer-application-packages in the weblogic-application.xml file in your EAR.

  • Resources inside JAR - problem

    I have a strange problem with resources inside JARs.
    I can't load any resource form a JAR file (for example a .property file or .png icon).
    It's not a problem with my progams only. JDBC drivers doesn't work because they cannot find .properties files while they work well when, the driver JAR i uncompressed. It happens every time when some resouces are inside JAR library (classes are loade correctly). The same project runs well on my friend's computer while I've got an error on my computer.
    I tried it on WinXP and Win2003 Server - the same. My java version 1.5.0_06-b05 (but I had the same problem with older versions).
    I figured out that I can find a file inside a JAR, open a stream, load data and everything is OK but data is always 0bytes length. For example using:
    ImageIcon myImageIcon = new ImageIcon(getClass().getResource(pathandfilename));
    I get empty ImageIcons without any error.
    Can anyone help me. Maybe I should find something somwhere in java configuration.
    Message was edited by:
    peper

    But can anyone tell me why my servlet can not access the
    contents inside a jar file?? Any suggestions please?
    Thanks.Without seeing your code, it is likely that you are trying to use file names (like /some/path/yourFileName.ext), not resource names (loadable from the class loader) like /yourFileName.ext.
    Example:
    Instead of:
    FileInputStream stream = new FileInputStream("/some/path/yourFileName.ext");
    do this:
    InputStream stream = getClass().getResourceAsStream("/yourFileName.ext");
    There are other API's which take either a string file name or a URL. You want to go the URL way, where the URL is taken from the classpath as:
    URL url = getClass().getResource("/yourFileName.ext");

  • Load library from JAR file

    Could I ask you guys a stupid question, please?
    I have a library as an JAR file. I build my application as another JAR file, which includes that library file.
    My manifest file is:
    Manifest-Version: 0.1.0
    Class-Path: lib/mysql-connector-java-3.0.17-ga-bin.jar
    Main-Class: com.myappand the build command:
    jar cvfm hello.jar mymanifest -c com  -c libThe result hello.jar file built OK. But when I run it, I have to copy library file to the same folder to the app file.
    Could you tell me how to load the lib file from hello.jar, instead of the lib file?
    Thanks in advance!
    Best regards,
    Lehoanq

    am I right in thinking you've put the mysql jar inside your application jar? jars don't work like that, I'm afraid. it is possible to write a classloader that will load classes from within a jar-inside-a-jar, but it gets rather complicated and messy and isn't worth the hassle to be honest, anyway. we go to some lengths to keep our software modular and separate. imagine, for instance, that a bug is exposed in the mysql driver you're using, and a new release is needed to fix it. the dependency is rooted inside your application, so the whole shebang has to be re-packaged and re-deployed, whereas if your dependencies were inside a lib folder, all that would be needed is to drop the new version of the mysql driver into the lib directory. think "don't put all your eggs in one basket"
    what you want to do is possible, and there are tools around to do it for you, too, but IMHO it's not worth the effort

  • Problem loading image from jar file referenced by jar file

    First, I searched this one and no, I didn't find an answer. Loading images from jar files has been pretty much done to death but my problem is different. Please read on.
    I have my application, a straight up executable running from Eclipse. It uses a jar file, call it JarA. JarA launches a GUI that is located in another jar file. Call it JarB. To recap:
    My application calls JarA -> JarA loads classes from JarB -> JarB looks for images to place in a GUI it wants to show on the screen
    When JarB goes to load an image the following happens:
    java.lang.NullPointerException
         at sun.misc.URLClassPath$3.run(URLClassPath.java:316)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:313)
         at sun.misc.URLClassPath.getLoader(URLClassPath.java:290)
         at sun.misc.URLClassPath.findResource(URLClassPath.java:141)
         at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
         at java.lang.ClassLoader.getResource(ClassLoader.java:977)
         at org.cubrc.gmshell.gui.MainWin.preInit(MainWin.java:152)
         at org.cubrc.gmshell.gui.MainWin.<init>(MainWin.java:135)
    The code from JarB that loads the image looks like this:
              URL[] oSearch = {Main.class.getResource("images/")};
              URLClassLoader oLoader = new URLClassLoader(oSearch);
              imgIcon = new ImageIcon(oLoader.getResource("icon.gif"));
              imgMatchRunning = new ImageIcon(oLoader.getResource("gears.gif"));
              imgMatchStill = new ImageIcon(oLoader.getResource("gears-still.gif"));
              imgMagnify = new ImageIcon(oLoader.getResource("magnify.gif"));This looks right to me and JarB certainly has an images directory with those files. But I'm in hell right now because I don't know where to place the images to make this work or if you can even attempt to load images with a dependency chain like this.
    Any help very appreciated!

    Have you tried to move your image-files out of the jar file and place them in the sam folder as the jar-file? I think that would help.
    When you try to load the image-file you get the NullPointerException because the program tries to read a file it can't find. Remember that a jar file IS a file and not a directory.
    If you want to read somthing inside the jar-file you need to encode it first.
    Have you tried to read the jar-file with winRar. It makes it easy to add and remove files in your jar-file.

  • Problem Loading some symlinked jars

    Hi,
    We have a very strange problem with loading jars (which are symlinks).
    We are loading about 20 jars inside a certain directory and all are ok, except 1 sometimes (x.jar)
    Lets say the files are inside /opt/shared/lib and ls /opt/shared/lib shows:
    a.jar -> /opt/a/a.jar
    b.jar -> /opt/b/b.jar
    c.jar -> /opt/c/c.jar
    d.jar -> /opt/d/d.jar
    x.jar -> /opt/x/x.jar
    For some reason loading x always gives the exception:
    Caused by: java.security.AccessControlException: access denied (java.io.FilePermission /opt/x/x.jar read)
    When we look at /opt/x/x.jar, the permissions are fine. Now comes the strange part.
    After some tries we ended up with (d.jar was obsolete):
    a.jar -> /opt/a/a.jar
    b.jar -> /opt/b/b.jar
    c.jar -> /opt/c/c.jar
    x.jar -> /opt/x/x.jar
    and everything works as expected.
    Then we:
    1. remove the symlink x.jar
    2. add a new (dummy) file to this directory
    3. make the symlink again
    4. remove the dummy file
    Now the problem occurs again and we get the above io.FilePermission exception.
    Now if we:
    1. remove the symlink
    2. make the symlink again
    The exception is gone, it seems as if the symlinks takes the physical place of the dummy file on the filesystem.
    Redoing the above sequences gives again the FilePermission exception and finally OK again.

    bami wrote:
    I'm not sure what you mean with cat ïng to /dev/null.I meant to try this in the shell, when you have the problem:
    cat /opt/shared/lib/x.jar > /dev/nulland see if it succeeds (i.e. prints nothing).
    If that works, then there's a Java problem, if it doesn't work, then Java is not the problematic element in the equation.
    The OS is Solaris (sparc) with kernel Generic_137111-08. The Filesystem is UFS.Unfortunatley I have no experience with Solaris whatsoever, so I can't comment on that.

  • Referencing a jar inside another jar

    Hi All,
    If there is a jar "B" inside jar "A", how to include jar "B" in the manifest's classpath of jar "A"??
    Regards,
    P

    let me know if you figure out the answer to this question. I am working on a executible jar and I reference lib/somJar.jar on my manifest file. I thought that it was working because it was loading, but when I tried to move the jexeutible jar it no longer worked. Well I found that it was loading the information from the directory, which was teh same directory that I used to jar the files rather than the actuall jar file.

  • How to edit a text file inside jar

    Hi all;
    I have a code that created text file and put this file to other jar archive.
    How can I edit this text file inside jar, add string to this file ?
    Thanks,

    Unpack the jar, edit the file, repack the jar.

  • Loading an entire JAR via a classloader

    Hi how would I load an entire JAR file via a classloader. Currently I'm able to load one file at a time (in this case org.w3c.dom.Node) as shown below:
    import java.net.*;
    public class MyJarLoader {
       public static void main(String [] args) throws Exception {
         URL[] urlsToLoadFrom = new URL[]{new URL("file:subdir3/xml-apis.jar")};
         URLClassLoader loader1 = new URLClassLoader(urlsToLoadFrom);
         Class cls1 = Class.forName("org.w3c.dom.Node", true, loader1);
         System.out.println("Loaded '"+cls1.getName()+"'");
         org.w3c.dom.Node Node = (org.w3c.dom.Node) cls1.newInstance();
    Thanks

    Figured this one out as below. Note this is the simplistic solution since it requires that the jar files be present in the classpath. If not, you will have to write your own loadClass method to read the data from the zip (& then can't use the method 'Class.forName()').
    Regards
    //Load Apache JAR files
    URL[] urlArrToLoadFrom = new URL[]{new URL("file:xalan-j_2_5_0/xml-apis.jar"),
                new URL("file:xalan-j_2_5_0/xercesImpl.jar"), new URL("file:xalan-j_2_5_0/xalan.jar")};
    //Create a URLClassLoader to access jar files
    URLClassLoader urlLoaderGeneric = new URLClassLoader(urlArrToLoadFrom);
    //Foreach jar file, open, load class files & close
    for(int i=0; i<urlArrToLoadFrom.length; i++) {
    //Debug
       System.out.println(urlArrToLoadFrom.toString());
       //Open zip file
       ZipFile zf = new ZipFile(urlArrToLoadFrom[i].getFile());
       for (Enumeration enum = zf.entries(); enum.hasMoreElements();) {
         //Get entry
         ZipEntry ze = (ZipEntry) enum.nextElement();
         //Only load if it's not a directory and it's a class file
         int iIndexClass = -1;
         if (!ze.isDirectory() && ((iIndexClass = ze.getName().indexOf(".class")) != -1)) {
             //Remove .class & replace / with .
             String strApacheClassName = (ze.getName().substring(0,iIndexClass)).replace('/','.');
             //Load class file
             Class classApache = Class.forName(strApacheClassName, true, urlLoaderGeneric);
             System.out.println("Loaded '"+classApache.getName()+"'");
       //Close zip
       zf.close();

  • Loading Xlet via .jar

    Hi everybody,
    i've got an Xlet containing about 100 classes and some resources. Since the startup-time is beyond the pale when files are loaded separetely by the object carousel, I want to load them with some .jar-files.
    Therefore I wrote a custom ClassLoader that overrides the loadClass(String,boolean)-method as required in JDK1.1.8, reads the .jar as dsmccObject and defines/resolves the class. And everything's working so far.
    part of sample code for loading from repository:
    <code>
    DSMCCObject dsmccZipFile = new DSMCCObject("test1.jar");
    dsmccZipFile.asynchronousLoad(this);
    FileInputStream fi = new FileInputStream(dsmccZipFile);
    ZipInputStream zis = new ZipInputStream(fi);
    ZipEntry entry = null;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    while((entry = zis.getNextEntry()) != null){
         String entryName = entry.getName();
         if(entryName.equals(className+".class")){
              buffer = new byte[1024];
              int len=0;
              while((len=zis.read(buffer)) != -1){
                   baos.write(buffer, 0, len);
              zis.closeEntry();
              zis.close();
              byte[]classBytes = baos.toByteArray();
              baos.close();
              return classBytes;
    </code>
    Cause I'm a newbie to classLoaders, I have the following problem:
    The classes from the jar files are not known at build-time, so that I'm not able to do typecasting and calling the classes' methods.
    The only way I handled the problem was the ReflectionAPI.
    <code>
    Class c = mcl.loadClass("test", true);
    Object o = c.newInstance();
    Method method = c.getMethod("aMethod", new Class[0]);
    method.invoke(o, new Object[0]);
    </code>
    It works, but i don't like this solution, since it will result in complex code and the reflection's performance is not so high in comparison to direct method calls.
    Another solution would probably be a common known interface, which calls methods, but that's worse i think and i had to implement the interface in all classes.
    => my questions:
    1) Is there a common solution for jar-loading in MHP (i'm surely not the only one with a bad startup-time if loading files seperately)?
    2) If not: is there a better solution than mine (using the reflection api) (the source will be the same: initial ClassLoader.class and .jar's send from same source over the oc)?
    3) Should I extend org.dvb.lang.DVBClassLoader (I simply extended java.lang.ClassLoader) and which parentClassLoader should I use as second parameter? I tested it once with the Xlet's ClassLoader (getClass().getClassLoader()) but the problem is of course still the same.
    4) Is there a reason that there is no jar support in the mhpAPI / environments (resp. those i know)? I simply used ZipInputStream instead of JarInputStream. Are jar classes available for download anywhere?
    THX
    regards,
    Ben

    Thanks to desperado for pointing out that you couldn't load classes from JAR files. I thought that was the case, but couldn't find where in the spec said it, so I assumed I was wrong. Ho hum.
    To answer your questions:
    - caching can be done on either the module level of the file level. MHP is pretty flexible about this, and doesn't define how much cache will be present (having no cache at all is acceptable, but most boxes have some)
    - module arrangement will not always help, but it does make things easier. What you can do in DSM-CC that you can't do in HTTP is change the repetition rate of modules, so that commonly-used modules are transmitted more often (and thus have less latency) than less commonly used modules. Of course, this does affect the time needed to transmit the entire carousel.
    - jars work pretty well in an internet app, but they're much less use in a DTV environment because you're transmitting your apps in a carousel. See below for why this is the case.
    - you are right that you have to load files separately and not from JAR files. Loading from JAR files is not interoperable.
    Loading classes from a JAR file would be slower because you have to wait for the entire file to load before you get any classes out of it. Depending on the size of your file, this can have a number of problems:
    1) you need to load the entire JAR file. This means that you have to load all of the files, not just the ones you need, which takes longer. You're still only transmitting your object carousel at the same speed.
    2) using modules that group together your files in a logical way may make better use of the DSM-CC cache in the receiver. If the receiver caches modules, then grouping files that are used together in the same module means that you will have less latency when loading files froma cached module. This gives you some of the benefits if using a JAR file in a more flexible way.
    3) DSM-CC can compress the data in your files before transmitting it, so using a JAR file won't actually help you much in terms of reducing space.
    The only tutorials that I know of that discuss DSM-CC are mine and the ETSI documentation. If you find any more, please let me know.
    Steve.

  • Batch loading with sdordf.jar.

    Hi Guys
    I have just tried a batch load with sdordf.jar.
    In my first attempt there was a mistake in the n3 file.
    After correcting the file and re running I now get the error.
    Connecting to jdbc:oracle:thin:...........
    Append mode
    Copy existing data out
    Just load triples into one column
    Temporary table already exists!
    java.sql.SQLException: ORA-00955: name is already used by an existing object
    ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 3326
    ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 3362
    ORA-06512: at "MDSYS.RDF_APIS", line 786
    ORA-06512: at line 1
    Can anyone tell me what the name of this temporary table is, so that I can get rid of it.
    Cheers
    Phil

    Hi Mellie
    After having a little break I have installed the jena patch during which I had to drop the network and model created before.
    I tried running a batch load as before but I still get the error message saying the temporary table already exists.
    I tried the clean up routine as suggested but get the error.
    SQL> exec sdo_rdf.cleanup_batch_load('researchdata')
    BEGIN sdo_rdf.cleanup_batch_load('researchdata'); END;
    ERROR at line 1:
    ORA-13199: Batch load cleanup failed. ORA-00942: table or view does not exist
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.SDO_RDF", line 1016
    ORA-06512: at "MDSYS.SDO_RDF", line 1022
    ORA-06512: at line 1
    I run it as mdsys as you said.
    Any other suggestions?
    Cheers
    Phil

  • Why can I load Image from jar?

    hi,all:
    I've packed all gif images into a jar file,it works well on jdk1.4.2_05 with this command:
    java -jar pos.jar
    but failed on other jdk versions lower than jdk1.4.2_05.
    here is the package structure:
    &#9500;&#9472;resource
    &#9474; &#9500;&#9472;configfile
    &#9474; &#9492;&#9472;images
    here is the code getting url:
    package resource
    public class ResourceLoader {
    public ResourceLoader() {
    public URL getResource(String fileName){
    URL url=ResourceLoader.class.getResource(fileName);
    if(null==url){
    throw new NullPointerException(fileName+" not found");
    return url;
    with this url, I will use
    toolkit.getImage(url);
    to load the image.
    exception on 1.4.1_01:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D2835EB
    Function=JNI_OnLoad+0x249
    Library=C:\j2sdk1.4.1_01\jre\bin\jpeg.dll
    Current Java thread:
    at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
    at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:144
    at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j
    ava:257)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:168)
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
    Dynamic libraries:
    0x00400000 - 0x00406000 C:\j2sdk1.4.1_01\bin\java.exe
    0x77F80000 - 0x77FFA000 C:\WINNT\system32\ntdll.dll
    0x77D90000 - 0x77DEB000 C:\WINNT\system32\ADVAPI32.dll
    0x77E60000 - 0x77F32000 C:\WINNT\system32\KERNEL32.dll
    0x786F0000 - 0x7875E000 C:\WINNT\system32\RPCRT4.dll
    0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
    0x6D330000 - 0x6D45A000 C:\j2sdk1.4.1_01\jre\bin\client\jvm.dll
    0x77DF0000 - 0x77E4F000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F79000 C:\WINNT\system32\GDI32.dll
    0x77530000 - 0x77560000 C:\WINNT\system32\WINMM.dll
    0x75E00000 - 0x75E1A000 C:\WINNT\system32\IMM32.DLL
    0x6C330000 - 0x6C338000 C:\WINNT\system32\LPK.DLL
    0x65D20000 - 0x65D74000 C:\WINNT\system32\USP10.dll
    0x6D1D0000 - 0x6D1D7000 C:\j2sdk1.4.1_01\jre\bin\hpi.dll
    0x6D300000 - 0x6D30D000 C:\j2sdk1.4.1_01\jre\bin\verify.dll
    0x6D210000 - 0x6D229000 C:\j2sdk1.4.1_01\jre\bin\java.dll
    0x6D320000 - 0x6D32D000 C:\j2sdk1.4.1_01\jre\bin\zip.dll
    0x6D000000 - 0x6D0FB000 C:\j2sdk1.4.1_01\jre\bin\awt.dll
    0x777C0000 - 0x777DE000 C:\WINNT\system32\WINSPOOL.DRV
    0x75010000 - 0x75020000 C:\WINNT\system32\MPR.dll
    0x77A30000 - 0x77B1C000 C:\WINNT\system32\ole32.dll
    0x6D180000 - 0x6D1D0000 C:\j2sdk1.4.1_01\jre\bin\fontmanager.dll
    0x51000000 - 0x51044000 C:\WINNT\system32\ddraw.dll
    0x72800000 - 0x72806000 C:\WINNT\system32\DCIMAN32.dll
    0x72CF0000 - 0x72D63000 C:\WINNT\system32\D3DIM.DLL
    0x6DD30000 - 0x6DD36000 C:\WINNT\system32\INDICDLL.dll
    0x53000000 - 0x53007000 C:\PROGRA~1\3721\helper.dll
    0x70BD0000 - 0x70C34000 C:\WINNT\system32\SHLWAPI.dll
    0x37210000 - 0x3723E000 C:\WINNT\DOWNLO~1\CnsMin.dll
    0x777E0000 - 0x777E7000 C:\WINNT\system32\VERSION.dll
    0x75950000 - 0x75956000 C:\WINNT\system32\LZ32.DLL
    0x12F10000 - 0x12F25000 D:\JBuilder7\lib\ext\jbWheel.dll
    0x6D280000 - 0x6D29E000 C:\j2sdk1.4.1_01\jre\bin\jpeg.dll
    0x77900000 - 0x77923000 C:\WINNT\system32\imagehlp.dll
    0x72960000 - 0x7298D000 C:\WINNT\system32\DBGHELP.dll
    0x687E0000 - 0x687EB000 C:\WINNT\system32\PSAPI.DLL
    Local Time = Fri Jul 16 10:06:45 2004
    Elapsed Time = 2
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)
    # An error report file has been saved as hs_err_pid2320.log.
    # Please refer to the file for further information.

    help!!!!

  • How to load an applet jar file?

    Hello everyone,
    I have an applet that uses my own jar file and approximately 6 third party jar files. I set up jar indexing (jar -i) which will download the jar files when they are needed. All seems to work well, but now I want to manually load the jar files which I cannot get working.
    When the applet starts, about 1/2 of the jar files are downloaded (because they are needed at startup). I then want to load the additional jar files in the background, after the gui is initialized. I have tried this using the below thread which is executed from within the applet's start method:
    // Try to load additional jar files in background by loading a class from each jar file.
    Thread loadClass = new Thread() {
      public void run() {
        System.out.println("Loading classes...");
        try {
          // Tried loading classes this way, doesn't work.
          getClass().getClassLoader().loadClass("pkg1.Class1");
          getClass().getClassLoader().loadClass("pkg2.Class2");
          getClass().getClassLoader().loadClass("pkg3.Class4");
          getClass().getClassLoader().loadClass("pkg4.Class4");
          /* Loading classes this way doesn't work either.
          Class.forName("pkg1.Class1");
          Class.forName("pkg2.Class2");
          Class.forName("pkg3.Class3");
          Class.forName("pkg4.Class4");
        catch(ClassNotFoundException e) {
          // First attempt to load a class (pkg1.Class1) throws exception.
          System.out.println("Can't find class: " + e.getMessage());
    loadClass.start();As you can see from above I am trying to load a class from each of the jar files so that the jar files would load into memory/cache. Unfortunately, it cannot find the classes. These are the errors from the java console:
    Loading classes...
    Loading: pkg1.Class1
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with no proxy
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with cookie "JSESSIONID=some_big_long_char_list"
    Can't find class: pkg1.Class1
    So it appears the jar file is not being downloaded. When I take away the dynamic jar loading (removing the "jar -i" & adding them all to the applet archive list) the thread executes correctly. So I know the class names, etc, are correct. How does one load an applet jar file?
    Any help/suggestions are appreciated.

    The above error I posted was because I forgot to index the jar files. That is why it couldn't find the jar file. I thought I was getting farther along with my problem, but I apparently just forgot to index the jars. I am now getting the problem that I got yesterday...
    The applet freezes/hangs when it hits the thread. The GUI never opens (even though I'm running this thread right after the gui shows). The java console quits responding and the applet just stays the grey screen. I also tried the invoke later that you suggested.
    public void start() {
      // ...initialize gui...
      // Applet freezes and remains grey, also the java console freezes.
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          System.out.println("Loading classes...");
          try {
            // When I comment out the below forName calls, the thread will still run evidenced through the done print statement.
            Class.forName("pkg1.Class1");
         Class.forName("pkg2.Class2");
         Class.forName("pkg3.Class3");
         Class.forName("pkg4.Class4");
            System.out.println("...Done loading classes");
          catch(Exception e)     {
            System.out.println("Can't find class: " + e.getMessage());
    }

Maybe you are looking for