It's not a secret anymore!
The moose likes Servlets and the fly likes System.getProperty returns null value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "System.getProperty returns null value" Watch "System.getProperty returns null value" New topic

System.getProperty returns null value

Kathy Griffin

Joined: Mar 24, 2008
Posts: 1
I have a properties file at a certain location on my file system. In my application server (Websphere 5.1)I have set a variable in the JVM System Properties that points to the property file. These are the lines of code to access the variable

This all works fine when I test it in RAD on my local machine, but when I deploy this solution to an app server running on Unix I noticed peculiar behavior. (Btw I have setup a variable on the that server too)The first time that I try to bring up the webpage that accesses the properties file, the app server log displays a message
IOException: null/properties.file (No such file or directory)
This leads me to believe that System.getProperty is returning null. However, if I close the browser and open up my webpage again I'm able to access the file.

Is there something I don't know about System.getProperty? Btw getServletContext.getRealPath...etc are not options because the file is at a different location than the application.
I agree. Here's the link:
subject: System.getProperty returns null value
jQuery in Action, 3rd edition