转载:https://www.cnblogs.com/acm-bingzi/p/6673823.html
很多时候我们需要在项目中读取外部属性文件,用到了System.getProperty("")方法。这个方法需要配置JVM系统属性,那么如何配置呢?

那就是使用java -D 配置系统属性。
使用格式是:java -Dkey=value

比如新建一个测试类,如下:

public class Test {
    public static void main(String[] args){
     System.out.println(System.getProperty("configurePath"));
    }
}
View Code

相关文章:

  • 2021-06-11
  • 2021-09-21
  • 2021-12-15
  • 2022-03-04
  • 2022-12-23
  • 2021-12-14
  • 2021-09-29
  • 2022-02-10
猜你喜欢
  • 2021-12-07
  • 2022-12-23
  • 2021-06-25
  • 2021-10-17
  • 2021-04-13
  • 2021-11-25
相关资源
相似解决方案