Java tutorial
//package com.java2s; import java.io.File; public class Main { private static File savesDir; public static File getSaveGameDir() { if (savesDir != null) { return savesDir; } File userHome = new File(System.getProperty("user.home")); File userMaps = new File(userHome, "saves"); if (!userMaps.isDirectory() && !userMaps.mkdirs()) { // if it does not exist and i cant make it throw new RuntimeException("can not create dir " + userMaps); } savesDir = userMaps; return userMaps; } }