How can I save a file with a generic file path for Windows, Mac and Linux?

java

Solution

System.getProperty("user.dir");

Or if you're using Java 7

Filesystems.getDefault();

will give you the base directory from which to work.

Problem

I have an aplicattion that needs to create a folder to unzip some files, but I want to pass a file path that my application could run, create and save my files in any OS, but I don't know what should be the output Path to do that. for example: ``` File folder = new File(outputFolder); if (!folder.exists()) { folder.mkdir(); } ``` What path should I use in outputFolder to create my folder in Documents/UnzipTest in any Operation System (Windows, mac or linux)?

Original source

Related problems