Results 1 to 2 of 2

Thread: ClassLoader.getResourceAsStream of resource in external JAR does not work

  1. #1
    Join Date
    Mar 2010
    Posts
    28

    Default ClassLoader.getResourceAsStream of resource in external JAR does not work

    Hi,

    I'm using DM 2.0.0 release.

    My application runs as web bundle and I'm trying to read resource from external JAR which was added to Bundle-Classpath and it does not work.

    I added to MANIFEST.MF:
    Code:
    Bundle-ClassPath: .,/tmp/client-config.jar
    The resource is a clientinit.0 file in client-config.jar.

    The in bundle code:
    Code:
    ClassLoader cl = this.getClass().getClassLoader();
    InputStream in = cl.getResourceAsStream("clientinit.0");
    in = cl.getResourceAsStream("/clientinit.0");
    I get null for 'in' variable.

    When debugging, I see that 'cl' has the /tmp/client-config.jar in its' classpath member.

    Please help !!!

    Thanks,
    Pavel

  2. #2
    Join Date
    Mar 2010
    Posts
    28

    Default

    Found the solution.

    Since the JAR is external from bundle it should be surrounded with:
    external:$<filename/foldername>$

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •