0

我有桌面应用程序。我做 jar-file,但我有文件到这个 jar 中需要更改的内容。我使用 TrueZip <> 我试过:

OutputStream out = new FileOutputStream("myjar.jar"+"/com/mycompany/confProperties.properties");
try{
    properties.store(out, "Changed by User");}
finally{
    out.close();
}
TFile.umount();

它适用于 Eclipse,但是当我从命令行执行我的 jar 时出现异常:

java.io.FileNotFoundException: myjar.jar/com/mycompany/confProperties.properties
at de.schlichtherle.truezip.file.TFileOutputStream.newOutputStream(TFileOutputStream.java:147)
at de.schlichtherle.truezip.file.TFileOutputStream.<init>(TFileOutputStream.java:83)

如果我只使用“/com/mycompany/confProperties.properties”而不是“myjar.jar”+“/com/mycompany/confProperties.properties”,我有

java.io.FileNotFoundException: \com\fujitsu\gdcru\accesschecker\client\confProperties.properties
at de.schlichtherle.truezip.file.TFileOutputStream.newOutputStream(TFileOutputStream.java:147)
at de.schlichtherle.truezip.file.TFileOutputStream.<init>(TFileOutputStream.java:83)

我可以更改此文件吗?如何?

4

0 回答 0