我已经完成了我试图安装到 linux 机器上的 java 程序。不幸的是,我的程序没有看到属性文件并获取默认值。告诉java属性文件放在哪里的方法是什么?
Program is placed in:
/opt/myProg
Properties are placed in:
/opt/myProg/config.ini
external jar:
/opt/myProg/lib
classes in packeges:
/opt/myProg/Prog
Command I'm trying to run my program:
java -cp /opt/myProg/lib/log4j.jar:/opt/myProg/Prog:/opt/myProg/. startpkg.runme
此命令也无济于事:
java -cp /opt/myProg/lib/log4j.jar:/opt/myProg/Prog:/opt/myProg/. startpkg.runme -Dconfig.ini=/opt/myProg/config.ini
尝试加载道具的代码如下所示:
p.load(new FileInputStream("config.ini"));