java 打jar包配置文件和jar包通级
类
public class jarTs { public static void main(String[] args) throws IOException { String path =System.getProperty("user.dir"); System.out.println("user.dir: " + path); String proPath = path + File.separator +"properties"; FileInputStream in = new FileInputStream(proPath); Properties props = new Properties(); props.load(in); in.close(); String libPathKey = "lib_path"; String libPath = props.getProperty(libPathKey); System.out.println("lib文件路径," + libPath); } }
配置文件 properties
# ip and port of server socket ip=127.0.0.2 lib_path = "D:\\Java_project\\faceRec2.0\\arcsoft_lib" port=9999 # error message