Loading...

May 13, 2009

Working with properties files in NetBeans

Properties files can be part of our Java applications, for example to store configuration settings. In NetBeans we create a new properties file via File | New File... | Other | Properties File. To add properties we simply open the file and add properties as a key=value pair in the editor. But we can use another method: right-click on the properties file and select Add | Property...:

NetBeans opens a small dialog window and we can type the name, value and a comment (optional) for the new property. We click on the OK button to insert the property in our file.

In the Project Navigator we can view all properties in a properties file by clicking on the little arrow in front of the file. We select the property and the editor jumps to right position in the file.