资源读取
程序员文章站
2022-06-08 17:16:00
...
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class Demo {
public static void main(String[] args) throws IOException {
ClassLoader cl = Demo.class.getClassLoader();
InputStream in = cl.getResourceAsStream("bap-client.properties");
Properties p = new Properties();
p.load(in);
String cmdId = p.getProperty("relay.cl5.cmdId");
System.out.println(cmdId);
}
}