aspose file tools
The moose likes Java in General and the fly likes How To Read boolean value from a property file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How To Read boolean value from a property file" Watch "How To Read boolean value from a property file" New topic
Author

How To Read boolean value from a property file

Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 228

Hi All,

I have a small question I have code like below


I want to read the values like true or false from a property file named input.properties instead of hard coding it . How to do it . Can somebody shed some light am confused.


Regards, Ricky
Oracle Weblogic 10g Certified Expert
TechBlog
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
Take a look at Boolean.parseBoolean()!


OCJP 6 (93%)
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 228

I am getting a error of



Code:


Executing as java -classpath ./inputs.properties -jar ./myTool.jar blah blah

Please help.
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 228

Zandis Murāns wrote:


What Do you mean by this. Can you please make me understand with some example.
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

Yeah, sure.

Create properties file, for example c:\my.properties
In this file define some properties, for example

next, in your java code, create instance of java.utils.Properties class:

fulfil this object with your properties:

Now assign your variables
Ramakanta Sahoo
Ranch Hand

Joined: Aug 23, 2008
Posts: 228

Thanks for the description.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To Read boolean value from a property file
 
Similar Threads
Prepopulating Radio buttons in JSP
how xdoclet can create composite-id ????
How to do a Merge in a hibernate component
FileNotFound error while reading a properties file using relative path
Reading a single value from a pipe delimited dat file