当前位置: 技术问答>java相关
如何实现%%文件读取
来源: 互联网 发布时间:2017-04-29
本文导语: 我在win2000中设置环境变量set SUMIT_CONFIG=c:sumit 然后想在java代码中实现 File file = new File("%SUMIT_CONFIG%\config.xml"); 运行程序后报错 log4j:ERROR Could not read configuration file [%SUMIT_CONFIG%/log4j.txt]. java.io.FileNotFoundException: %S...
我在win2000中设置环境变量set SUMIT_CONFIG=c:sumit
然后想在java代码中实现
File file = new File("%SUMIT_CONFIG%\config.xml");
运行程序后报错
log4j:ERROR Could not read configuration file [%SUMIT_CONFIG%/log4j.txt].
java.io.FileNotFoundException: %SUMIT_CONFIG%/log4j.txt (The system cannot find the path specified)
然后想在java代码中实现
File file = new File("%SUMIT_CONFIG%\config.xml");
运行程序后报错
log4j:ERROR Could not read configuration file [%SUMIT_CONFIG%/log4j.txt].
java.io.FileNotFoundException: %SUMIT_CONFIG%/log4j.txt (The system cannot find the path specified)
|
你是不能从win2000的环境中得到的,因为系统通过System.getProperties()只能得到如下的东东:
java.version
java.vendor
java.vendor.url
java.home
java.vm.specification.version
java.vm.specification.vendor
java.vm.specification.name
java.vm.version
java.vm.vendor
java.vm.name
java.specification.version
java.specification.vendor
java.specification.name
java.class.version
java.class.path
java.library.path
java.io.tmpdir
java.compiler
java.ext.dirs
os.name
os.arch
os.version
file.separator
path.separator
line.separator
user.name
user.home
user.dir
java.version
java.vendor
java.vendor.url
java.home
java.vm.specification.version
java.vm.specification.vendor
java.vm.specification.name
java.vm.version
java.vm.vendor
java.vm.name
java.specification.version
java.specification.vendor
java.specification.name
java.class.version
java.class.path
java.library.path
java.io.tmpdir
java.compiler
java.ext.dirs
os.name
os.arch
os.version
file.separator
path.separator
line.separator
user.name
user.home
user.dir