views:

249

answers:

6

Do you know any libraries similar to java.util.Properties that support more advanced features like grouping properties, storing arrays, etc? I am not looking for some heavy super-advanced solution, just something light and useful for any project.

Thanks.

+8  A: 

Commons Configuration from the apache group sounds a lot like what you're looking for.

jon
+2  A: 

Yaml is an easy step up from basic text configuration, it allows for more structure and data types (including those you've mentioned) than property files, and for a lot of languages (including Java: Jyaml) it even has serialization support so mapping to/from your classes is often very easy.

Yaml is also lighter weight and simpler to get started with than going all the way to XML.

Kyle Burton
+2  A: 

I'm a big fan of the Spring framework for configuring objects and services. It uses an XML format and supports all the different types of Java collections and references to other objects. Not to tough to get started but also has a lot of powerful features you won't ever need.

Also XStream for simple XML serialization is really simple and easy to use.

Matt
+3  A: 

I've used java.util.prefs before, and it seems to do the trick for me. Your mileage may vary.

Chris Jester-Young
+2  A: 

I might consider JSON (JavaScript Object Notation). It is highly legible and Java code to read and write JSON formatted data is readily available.

+1  A: 

You might take a look at Commons Collections from apache

Alexandre Victoor