wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes locate properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "locate properties file" Watch "locate properties file" New topic

locate properties file

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
I have a build developed on window.Now this build need to be deployed on linux in jar format.working as user wasadmin

In this jar I am loading application.properties file from
b.jar is also in same folder

I am trying two options
1)in = new FileInputStream(
new File(propertiesFilePath+propertiesFile));

java.io.IOException: Unable to locate resource application.properties

where sct01.px-dc.dl.com is linux server name
which I am reading as
in = new FileInputStream(new File(propertiesFilePath+propertiesFile));
public static final String APPLICATION_PROPERTY_FILE = "application.properties";
public static final String APPLICATION_PROPERTY_FILE_PATH ="//sct01.px-dc.dl.com"+"/home/wasadmin/jar/";

2)if i replace above code with this
error message unable to access b.jar
important point for 2nd is when i run this jar on windows it is working fine
but when deployed on linux nothing happening

any idea
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
public static final String APPLICATION_PROPERTY_FILE_PATH ="//sct01.px-dc.dl.com"+"/home/wasadmin/jar/";

May I ask why you have added the "//sct01.px-dc.dl.com" to the front of the path?

If your code is on the same machine you don't need this (just use the "/home/wasadmin/jar/").

If your code is on a different machine, then you probably need to either tell it the network protocol lto use or (and probably a better solution) mount the remote directory somewhere in the filesystem of the local machine. But I would be surprised if this is the case from your description above.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
thanks you are right.machne name is not needed as code is on that machine only
It is sorta covered in the JavaRanch Style Guide.
subject: locate properties file