Results 1 to 8 of 8
Thread: Reading a properties file
- 04-03-2007, 09:45 AM #1
Member
- Join Date
- Mar 2007
- Posts
- 41
- Rep Power
- 0
- 04-03-2007, 11:31 AM #2
Senior Member
- Join Date
- Mar 2007
- Posts
- 134
- Rep Power
- 0
Java Code:// Read properties file. Properties properties = new Properties(); try { properties.load(new FileInputStream("filename.properties")); } catch (IOException e) { } // Write properties file. try { properties.store(new FileOutputStream("filename.properties"), null); } catch (IOException e) { }
- 04-06-2007, 03:54 AM #3
Sometimes I get an error that my application cannot find this properties file. I have been having a lot of issues with this lately. Any clues why?
- 04-06-2007, 02:47 PM #4levent Guest
Are you giving correct path to properties file? If properties file is not in the current working directory, you should give correct path (e.g. c:/1.properties or /home/levent/1.properties) to the FileInputStream and FileOutputStream constructors.Sometimes I get an error that my application cannot find this properties file. I have been having a lot of issues with this lately. Any clues why?
- 05-10-2007, 04:46 PM #5
Here is the error I am getting:
05/10/2007 10:12:58 [http-9090-Processor24]:med.tas.commons.util.Settings.loadSettingsFile()2 26 Cannot load settings file constants.conf; bad path supplied or file does not exist
java.io.FileNotFoundException: C:\Documents%20and%20Settings\pp\workspace\Bar CodePrintingService\web\WEB-INF\classes\constants.conf (The system cannot find the path specified)
But my file IS in the location that it mentions above. Why can it not find the path? Am running eclipse/tomcat.
thanks
- 08-09-2007, 07:08 PM #6
Senior Member
- Join Date
- Mar 2007
- Posts
- 134
- Rep Power
- 0
Include a file such that there is no space between the folder names in the path like "Docments And Settings"
- 05-06-2010, 12:26 PM #7
Member
- Join Date
- May 2010
- Posts
- 1
- Rep Power
- 0
what if I want to read a property file from remote location?
-
Similar Threads
-
Reading a properties file using resource bundle.
By rudrakanth in forum New To JavaReplies: 1Last Post: 02-27-2009, 12:23 PM -
Taking input from Properties File
By bugger in forum New To JavaReplies: 4Last Post: 05-07-2008, 09:30 AM -
How to getvalue from properties file into JSP
By jaga in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 04-04-2008, 08:00 AM -
Reading web applicaiton properties from JSP/Servlet
By Java Tip in forum Java TipReplies: 0Last Post: 01-30-2008, 09:56 AM -
doubt about language .properties file
By tommy in forum Advanced JavaReplies: 1Last Post: 07-31-2007, 02:38 PM


LinkBack URL
About LinkBacks

Bookmarks