*
The moose likes Java in General and the fly likes Load Data from Properties File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Load Data from Properties File" Watch "Load Data from Properties File" New topic
Author

Load Data from Properties File

Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

Hello, I would like to implement own config file for my Program (I mean configs loaded from properties file at program startup, also user will have possibility to edit these settings, from program window or simply by editing properties file)

Anyway, I made little test class, to see how does it really works. But I have a problem, I can load only Strings, its really strange for me.

My test class code:



I know why it works only for String.. because of this is included:

props .getProperty("StringTest");

But no idea how does it should look for INT and BOOLEAN, anyone can help me?
Ed Ward
Ranch Hand

Joined: Jan 30, 2006
Posts: 147
Are you saying you have properties named "BooleanTest" and "IntTest"?
If you are then you first need to retrieve them with props.getProperty("BooleanTest") and props.getProperty("IntTest") like you did with the "StringTest" property.
Then try parsing them. You're skipping a step.
 
 
subject: Load Data from Properties File
 
Similar Threads
Using DLL in Java
String add null to begining
Confusion in extending Thread Class
File Not found exception..
Exception in thread "main" javax.mail.AuthenticationFailedException: