code: public static File getApplicationDataDirectory(final String applicationName) {
          final String userHome = System.getProperty("user.home", ".");
          final File workingDirectory;
          final String osName = System.getProperty("os.name", "").toLowerCase();
          if (osName.contains("windows")) {
            final String applicationData = System.getenv("APPDATA");
            if (applicationData != null)
                workingDirectory = new File(applicationData, applicationName + '/');
              else
                workingDirectory = new File(userHome, '.' + applicationName + '/');
          } else if (osName.contains("mac")) {
            workingDirectory = new File(userHome, "Library/Application Support/" + applicationName);
          } else {
            workingDirectory = new File(userHome, '.' + applicationName + '/');
          }
          if (!workingDirectory.exists())
              if (!workingDirectory.mkdirs())
                  throw new RuntimeException("The working directory could not be created: " + workingDirectory);
          return workingDirectory;
      }
docs: Returns the appropriate working directory for storing application data. The result of this method is platform
  dependant: On linux, it will return ~/applicationName, on windows, the working directory will be located in the
  user's application data folder. For Mac OS systems, the working directory will be placed in the proper location
  in "Library/Application Support".
  <p>
  This method will also make sure that the working directory exists. When invoked, the directory and all required
  subfolders will be created.
  
  @param applicationName Name of the application, used to determine the working directory.
  @return the appropriate working directory for storing application data.