Java tutorial
//package com.java2s; //License from project: LGPL import java.io.File; public class Main { static File getDefaultGameDir() { String os = System.getProperty("os.name").toLowerCase(); String baseDir = null; String subDir = ".minecraft"; if (os.contains("win")) { baseDir = System.getenv("APPDATA"); } else if (os.contains("mac")) { subDir = "Library/Application Support/minecraft"; } if (baseDir == null) { baseDir = System.getProperty("user.home"); } return new File(baseDir, subDir); } }