How to Use ini4j

1) Create the file:

import java.util.prefs.Preferences;

import static java.lang.System.out;

public final class PreferencesSample {

  public static void main(final String[] args) {
    final Preferences prefs = Preferences.systemNodeForPackage(PreferencesSample.class);

    out.println(prefs.get("message", null));


2) Create the Sample.ini file:

message=Hello World!

3) Compile the file.

4) Set the java.util.prefs.PreferencesFactory system property to org.ini4j.IniPreferencesFactory and org.ini4j.prefs.system to Sample.ini.

5) Launch the PreferencesSample class.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s