[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to get the path of the application data folder ?

Posted on 2007-07-30
3
Medium Priority
?
4,797 Views
Last Modified: 2012-05-05
Hello

I'd like to know if it is possible to get the path, in java, of application data folder?
The result must be C:\Documents and Settings\...\Application Data

Thanks

Regards
0
Comment
Question by:pofpof98
3 Comments
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 1400 total points
ID: 19591784
Use this:

String dataFolder = System.getProperty("user.home") + File.separator + "Application Data";
0
 
LVL 92

Assisted Solution

by:objects
objects earned 600 total points
ID: 19591837
or u can use File class:

File appData = new File(System.getProperty("user.home"), "Application Data");
0
 
LVL 2

Expert Comment

by:freeexpert
ID: 19598363
IMHO the correct answer is
  System.getenv("APPDATA");

Of course, this is windoze specific, but it seems an installation may choose to keep appdata in a directory that is not System.getProperty("user.home") + File.separator + "Application Data".
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month19 days, 8 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question