9 Ağustos 2011 Salı

reading from properties file

a simple code snippet for reading from properties file:


import java.util.ResourceBundle;

Locale locale = new Locale("en_US");
ResourceBundle bundle = ResourceBundle.getBundle("mypropertiesfile", locale);
String name = bundle.getString("name");
String surname = bundle.getString("surname");

.. and the corresponding mypropertiesfile.properties should be in the classpath:


name = buffy
surname = vampireSlayer



Hiç yorum yok:

Yorum Gönder