Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Load Data from Properties File

 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic