当前工程读取配置文件示例
配置文件 示例 读取 当前 工程
2023-09-11 14:21:41 时间
当前工程目录读取配置示例:
public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(getConfigPath()); } public static String getConfigDir(){ String userDir=System.getProperty("user.dir"); if(System.getProperty("os.name").toLowerCase().contains("windows")){ return userDir+File.separator+"conf"; }else{ return userDir+File.separator+"conf"; } } public static String getConfigPath(){ return getConfigDir()+File.separator+"config.properties"; }
相关文章
- <转载> nginx服务器安装及配置文件详解 https://segmentfault.com/a/1190000002797601
- .Net配置文件——反射+配置文件存储类型实例
- Linux配置文件的生效顺序:profile、bashrc等
- PowerShell中的配置文件
- spring boot: 从配置文件中读取数据的常用方法(spring boot 2.3.4)
- EasyPlayerPro windows播放器本地配置文件配置方法介绍
- EasyPlayerPro Windows播放器读取xml配置文件中的特殊字符问题
- 在C#代码中应用Log4Net(三)Log4Net中配置文件的解释
- 一种Java Spring框架里将配置文件里定义的值注入到Java变量的简单办法
- linux c 读写 ini 配置文件
- Maven 多环境指定 Profile 环境编译打包 & Spring Boot 动态选择配置文件
- 日志log4cxx 封装、实例讲解、配置文件log4cxx.properties
- 分布式搜索elasticsearch配置文件详解
- 22.第六章 Shell脚本编程基础入门 -- bash配置文件、流程控制(五)