我有一個非常簡單的程序,我試圖將一個目錄添加到一個新的zip文件中。代碼:調用cp_rp方法時拋出的TrueZip異常
public class Encrypt {
public static void main(String[] args) {
TFile srcFile = new TFile(args[0]);
TFile destFile = new TFile("/home/myuser/archive.zip");
try {
TFile.umount();
} catch (FsSyncException e1) {
e1.printStackTrace();
}
try {
if (destFile.isArchive() || destFile.isDirectory())
destFile = new TFile(destFile, srcFile.getName());
srcFile.cp_rp(destFile);
} catch (IOException e) {
e.printStackTrace();
}
try {
TFile.umount();
} catch (FsSyncException e) {
e.printStackTrace();
}
}
}
這幾乎是代碼從here。 例外:
Jun 17, 2011 12:10:26 PM de.schlichtherle.truezip.fs.sl.FsDriverLocator$Boot <clinit>
WARNING: No provider available for class de.schlichtherle.truezip.fs.spi.FsDriverService
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.util.ServiceConfigurationError: file (unknown file system scheme - check run time class path configuration)
at de.schlichtherle.truezip.file.TArchiveDetector.newController(TArchiveDetector.java:341)
at de.schlichtherle.truezip.fs.FsDefaultManager.getController(FsDefaultManager.java:75)
at de.schlichtherle.truezip.fs.FsDefaultManager.getController(FsDefaultManager.java:65)
at de.schlichtherle.truezip.fs.FsFailSafeManager.getController(FsFailSafeManager.java:59)
at de.schlichtherle.truezip.file.TBIO.getInputSocket(TBIO.java:291)
at de.schlichtherle.truezip.file.TBIO.cp0(TBIO.java:229)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:193)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r0(TBIO.java:183)
at de.schlichtherle.truezip.file.TBIO.cp_r(TBIO.java:154)
at de.schlichtherle.truezip.file.TFile.cp_rp(TFile.java:3161)
at Encrypt.main(Encrypt.java:38)
... 5 more
我無法找到與此相關的例外項目頁面或其他頁面上的任何東西。有沒有人見過這個?我正在使用TrueZip 7.1.4。
可能會更好地添加一個簡單的jar與所有依賴項:http://repo1.maven.org/maven2/de/schlichtherle/truezip/truezip-samples/7.0/truezip-samples-7.0-jar-with-dependencies 。罐。 – Dan