Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > problems with jar

Reply
Thread Tools

problems with jar

 
 
stivazzi@gmail.com
Guest
Posts: n/a
 
      05-15-2008
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
 
Reply With Quote
 
 
 
 
Mark Space
Guest
Posts: n/a
 
      05-15-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems compiling Java-Prog with gcj using JavaMail (mail.jar) and JAF (activation.jar) Matthias Griem Java 6 02-08-2008 02:08 AM
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM



Advertisments