读取本地配置文件

package com.***;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class readPropertyIni {

public static void main(String[] args) throws IOException {
new readPropertyIni().getIniInfo();
}

public String getIniInfo() throws IOException{

String configpath = System.getProperty("user.dir")+"\config.ini";
File file = new File(configpath);
InputStream fl = new FileInputStream(file);
Properties ppt = new Properties();
ppt.load(fl);

Object obj = ppt.get("server");
System.out.println(obj);
return null;
}

}

#Wed May 10 08:47:29 CST 2017
version=2012
DB_NAME=quzhou2
out_put=D:/
server=192.168.1.1
CameraName=USB2.0
login_name=admin

原文地址:https://www.cnblogs.com/acme6/p/7593323.html