Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > loading .properites from jar

Reply
Thread Tools

loading .properites from jar

 
 
kem1
Guest
Posts: n/a
 
      06-07-2004
hi,

i have my.jar with the following structure:

my.jar
|
com
-my.properties

i.e. the properties file is on the top level in the jar. how can
access and load it from com.MyClass. When I run the com.myclass from
within the Eclispse IDE, all is fine. There, the resource file is on
on the same level as the com package (top level) and I access it with
../my.properties. Any help how to make it work from the console - I
have a small run.sh file that needs to to look something like

java -classpath "external.jar:my.jar" com.myClass

It says FileNotFoundException when I try ./my.properties or just
my.properties. I realise that executor is looking for the files on the
file system, not within the jar.


Thanks,

k
 
Reply With Quote
 
 
 
 
Manish Hatwalne
Guest
Posts: n/a
 
      06-07-2004
Try putting this inside your com package and then access it as
/com/my.properties from within a jar

- Manish

"kem1" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> hi,
>
> i have my.jar with the following structure:
>
> my.jar
> |
> com
> -my.properties
>
> i.e. the properties file is on the top level in the jar. how can
> access and load it from com.MyClass. When I run the com.myclass from
> within the Eclispse IDE, all is fine. There, the resource file is on
> on the same level as the com package (top level) and I access it with
> ./my.properties. Any help how to make it work from the console - I
> have a small run.sh file that needs to to look something like
>
> java -classpath "external.jar:my.jar" com.myClass
>
> It says FileNotFoundException when I try ./my.properties or just
> my.properties. I realise that executor is looking for the files on the
> file system, not within the jar.
>
>
> Thanks,
>
> k



 
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
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
Jar file cannot find main class - gfSetup.jar (0/1) James Alan Farrell Java 6 01-09-2004 12:40 PM



Advertisments