The Java program sometimes need to access the user application data directory, to save or get some temp or cache dates, the application data file path is defined as following:

Window XP or 2003:

C:\Documents and Settings\$USER$\Local Settings\Application Data

Windows Vista:


This directory is a special Windows folder, notice $USER$ specific logged username on current computer, by default the Application Data dir is hidden status.

1. Get user application data directory:

String dataFolder = System.getProperty("user.home") + "\\Local Settings\\Application Data";

2. Get it in file pattern:

File appData = new File(System.getProperty("user.home"), "\\Local Settings\\Application Data ");

A more simply way:

String dataFolder = System.getenv("APPDATA");