File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes How to find a key is avaiable in property file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "How to find a key is avaiable in property file" Watch "How to find a key is avaiable in property file" New topic
Author

How to find a key is avaiable in property file

Kaarthick Ramamoorthi
Greenhorn

Joined: Jul 21, 2010
Posts: 2
Hi,

I have a properties file with key/value continue=y. My requirement is to first find whether the key is avialable in this file and If it is available they I have to get the value.

I tried <isset> but it does not work out. Is there any element available to find the key?

Thanks
Kaarthick
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3206

Can you not just use the Java Properties class?


Cheers, Martijn - Blog, Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 23182

Kaarthick,
How did you load the property file into Ant? <isset> should work if you have loaded it correctly. Can you show the code?

Martijn,
If something can be done in native Ant, why would you want to insert Java code in a build script?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3206

Jeanne Boyarsky wrote:Kaarthick,
If something can be done in native Ant, why would you want to insert Java code in a build script?


You wouldn't, I was subtlety trying to get Kaarthick to state that he was using ANT
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 23182

Too subtle .
 
 
subject: How to find a key is avaiable in property file
 
MyEclipse, The Clear Choice