In Java, I need to find a way to locally store some data so that it is available between reboots. Simple things like Location / Size window.
I think the settings API meets this requirement. In a nutshell:
Applications require preferences and configuration data to adapt to the needs of different users and environments. The java.util.prefs package provides the ability for applications to store and retrieve user and system preferences and configurations. Data is stored permanently in an implementation-dependent storage. There are two separate preferred node trees, one for user preferences and one for preference system.
Below is a short but useful tutorial here . And here is a small example based on your requirements:
import java.util.prefs.Preferences; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class SwingPreferencesTest { private void createAndShowGUI() { JTextField dummyTextField = new JTextField(20); JFrame frame = new JFrame("Demo"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(dummyTextField); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); Preferences prefs = Preferences.userRoot().node(this.getClass().getName());
If you run it for the first time, you will see the default settings in the console:
width: 100.0 height: 100.0 x: 0.0 y: 0.0
If you run it again, these values ββwill be updated. In my case:
width: 240.0 height: 59.0 x: 130.0 y: 130.0
Edit
According to @Puce's comment below, Windows data is stored in the registry, and that makes sense because this is how Windows uses the user / system / software to store data. You can find the registry entry created in the example under HKEY_CURRENT_USER\JavaSoft\Prefs\[package\class name] , as shown in the figure below:

Note: tested on Windows 8 x64, JDK 1.7
If you do not want to fill out the registry with these settings, you can simply save the path to the folder of your application (as other applications do) and use this path to load configuration data from files with simple properties. The main advantage of using preferences (at least to save the path to applications) is the mechanism for receiving / storing configuration data intended for cross-platform ones, and JVM developers (and not developers) are people who have to deal with the actual implementation.