File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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 file from
b.jar is also in same folder

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

// Unable to locate resource

where is linux server name
which I am reading as
in = new FileInputStream(new File(propertiesFilePath+propertiesFile));
public static final String APPLICATION_PROPERTY_FILE = "";
public static final String APPLICATION_PROPERTY_FILE_PATH ="//"+"/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 ="//"+"/home/wasadmin/jar/";

May I ask why you have added the "//" 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 ~ 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
I agree. Here's the link:
subject: locate properties file
It's not a secret anymore!