loading .properites from jar

K

kem1

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
 
M

Manish Hatwalne

Try putting this inside your com package and then access it as
/com/my.properties from within a jar

- Manish
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top