读取jar外的属性文件

时间:2015-07-13 15:10:19

标签: java jar runnable

我的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

1 个答案:

答案 0 :(得分:0)

你可以尝试在= new FileInputStream中使用 InputStream(" ./ EDMSWS");

相关问题