problems with jar

Discussion in 'Java' started by stivazzi@gmail.com, May 15, 2008.

  1. Guest

    hi everybody, i have a problem: i never did applications like this...
    i have a jar, let's call it myJar.jar.
    inside the jar there are many folders
    /lib (with other used jars: jdbc, log4j, etc)
    /config, (reads some db connections params and other ones)
    /config/xml, (writes an xml file at runtime, and also dtd to validate
    it against with are there)
    /logs (writes logs, obviously :) )

    i read property file with
    Properties p = new Properties();
    p.load(classObject.getResourceAsStream("/config/config.properties"));
    from eclipse works as a bijoux.

    if i extract the jar.. if i have no folder named config at the same
    level as the jar, nothing works!
    i would like to read the file in the jar itself... i don't want to
    have folders out of the jar
    and... the same as for other libs! if i have no folder named lib at
    the same level as the jar, nothing works!

    the jar is called by a bat file in this way:
    java -Xbootclasspath/a:"lib/commons-lang-2.4-bin.zip;lib/
    log4j-1.2.8.jar;...." -jar "myJar.jar" AAA

    Thanks
    Andrea
    , May 15, 2008
    #1
    1. Advertising

  2. Mark Space Guest

    wrote:

    > i read property file with
    > Properties p = new Properties();
    > p.load(classObject.getResourceAsStream("/config/config.properties"));
    > from eclipse works as a bijoux.
    >
    > if i extract the jar.. if i have no folder named config at the same


    Hmm, "extract the jar"? You mean runout side of Eclipse? From your
    command line below, I guess that is what you mean.

    "getResourceAsStream" should work from inside a jar. Can you verify
    what the problem really is? Is this line returning nothing, or does it
    perhaps never execute?


    > the jar is called by a bat file in this way:
    > java -Xbootclasspath/a:"lib/commons-lang-2.4-bin.zip;lib/
    > log4j-1.2.8.jar;...." -jar "myJar.jar" AAA


    It is *very* unusual to set the boot-classpath. Are you really sure
    that's what you need to do?

    Please try -classpath instead of -Xbootclasspath and see if that works
    better.
    Mark Space, May 15, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    555
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,700
    muttley
    Oct 20, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,730
    Roedy Green
    Feb 14, 2006
  4. Arnold Peters
    Replies:
    0
    Views:
    641
    Arnold Peters
    Jan 5, 2005
  5. Matthias Griem
    Replies:
    6
    Views:
    557
Loading...

Share This Page