【发布时间】:2015-07-13 15:10:18
【问题描述】:
我的 jar 文件和属性文件位于同一位置 (C:\test)。当我通过脚本运行 jar 时,它会为属性文件引发 FileNotFound 异常。这通过 RAD 完美运行。我在这里做错了什么。我尝试了其他方法,例如获取 jar 文件的路径等,但也没有运气。
脚本:
@echo off
REM Eventually change directory to the program directory
cd C:\test\
REM run the program
"C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar "C:\test\test.jar"
读取属性文件的代码:
private void loadProperties() throws IOException{
appProperties = new Properties();
InputStream in = new FileInputStream("./EDMSWS.properties");
appProperties.load(in);
in.close();
}
清单文件:
Manifest-Version: 1.0
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
Rsrc-Class-Path: ./ commons-io-2.4.jar JSQLConnect.jar poi-3.11-201412
21.jar
Class-Path: .
Rsrc-Main-Class: com.example.xxx.xxxxx
【问题讨论】: