Java tutorial
//package com.java2s; //License from project: Apache License import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; public class Main { public static String getCurrentProject() { try { String value = ""; Properties properties = new Properties(); FileInputStream inputFile = new FileInputStream(System.getProperty("user.dir") + "/system.properties"); properties.load(inputFile); inputFile.close(); if (properties.containsKey("ProjectPath")) { value = properties.getProperty("ProjectPath"); String resultName = new String(value.getBytes("ISO-8859-1"), "gbk"); return resultName; } else return value; } catch (FileNotFoundException e) { e.printStackTrace(); return ""; } catch (IOException e) { e.printStackTrace(); return ""; } catch (Exception ex) { ex.printStackTrace(); return ""; } } }