views:

70

answers:

3

I am setting an external file to hold some persistent variables as Properties()

Is there an easy way to list these in the same way that

System.Properties()

does?? to produce a list of Properties I have set.

A: 

System.Properties() is just an instance of java.util.Properties.

Take a look at the docs: http://download.oracle.com/javase/6/docs/api/java/util/Properties.html

ZeissS
+1  A: 

try using config slurper

http://groovy.codehaus.org/ConfigSlurper

MTH
This looks an interesting route, but see below
john renfrew
I have en = jr.keys() String list for(Enumeration e = en; e.hasMoreElements() ;){list = list + "\n" + jr.get(e.nextElement()) } return list.replace('null\n', '')but was looking to get a list of the key names that are current as opposed to those in the file
john renfrew
A: 
String list
for(Enumeration e = jr.keys();
e.hasMoreElements()
;){list = list + "\n" + e.nextElement()
}
return list.replace('null\n', '')

Is there a more Groovy way to do it??

john renfrew