How to create local folder for program data on Windows (in %APPDATA%, without granting permissions, JAVA)

Viewed 65

How to create local folder for local program data in Java on Windows (in %APPDATA%, without granting windows permissions, I use JAVA)

I tried this code but file.mkdirs() doesnt create folder which indicates that I dont have permission to this folder

new File("%APPDATA%/PackMe/some_folder");

Ok found solution: System.getProperty("user.home") + "/PackMe/somefolder";

1 Answers

I think the appdata folder is this:

System.getProperty("user.home") + "\\PackMe\\somefolder";

or using the environment variable (which helped me when I encountered this problem too):

System.getenv("APPDATA");

Could you provide your full code and the stacktrace of the exception?

Related