• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

locate properties file  RSS feed

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
/home/wasadmin/jar/application.properties.
b.jar is also in same folder

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

//sct01.px-dc.dl.com/home/wasadmin/jar/application.properties
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
in=ClassLoader.getSystemResourceAsStream("com/application.properties");
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
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
arjun rampal
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks you are right.machne name is not needed as code is on that machine only
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!