problems with jar

S

stivazzi

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
 
M

Mark Space

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top