- InputStreaminputStream=this.getClass().getClassLoader().getResourceAsStream("ipConfig.properties");
- Propertiesp=newProperties();
- try{
- p.load(inputStream);
- }catch(IOExceptione1){
- e1.printStackTrace();
- }
- System.out.println("ip:"+p.getProperty("ip")+",port:"+p.getProperty("port"));
java读取配置文件
最新推荐文章于 2025-11-25 12:11:25 发布
本文介绍了一种使用 Java 的 InputStream 和 Properties 类从 ipConfig.properties 文件中读取 IP 地址和端口配置的方法。
1万+

被折叠的 条评论
为什么被折叠?



