Probleme pour décompresser avec gzip
Bonjour,
J'ai un problème, je n'arrive pas à utiliser une commande unix pour décompresser une archive .gz
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| public static void unzipFile(final File file, final boolean deleteZipAfter) throws IOException {
String zipName = "\"C:\\Program Files\\GnuWin32\\bin\\gzip.exe\" -d workspace_branche\\outil\\conf\\fichier.sql.gz";
try {
System.out.println(zipName);
Runtime runtime = Runtime.getRuntime();
runtime.exec(new String[] {zipName});
} catch (Exception ex) {
ex.printStackTrace();
}
if (deleteZipAfter)
file.delete();
} |
Ensuite voici mon message d'erreur :
Code:
1 2 3 4 5 6 7 8 9
| java.lang.IllegalArgumentException
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at util.file.FileTools.unzipFile(FileTools.java:37)
at util.file.FileTools.courseFolder(FileTools.java:20)
at util.file.FileTools.main(FileTools.java:56) |
et enfin ma ligne 37 corresponds à ça :
Code:
runtime.exec(new String[] {zipName});
Je n'arrive pas à comprendre comment il faut procéder et je suis dans une impasse donc si on pouvait m'expliquer :)
Merci d'avance :)