- I had use
zip4j
lib net.lingala.zip4j for build winrar projectjavafx
but had this error
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:/Program Files/Java/jdk-11.0.14/bin/java.exe'' finished with non-zero exit value 1 at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414) at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:52)
- I had add lib to dependencies to gradle
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.9.0'
- In file module-info.java I had added
requires javafx.controls;
requires javafx.fxml;
requires zip4j;
opens com.example.compresszip to javafx.fxml;
exports com.example.compresszip;
}
// In main class i had added
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.model.enums.CompressionMethod;
public class ZipDemo {
public static final String OUTPUT_ZIP_FILE = "D:\\demozip\\cms.zip";
public static final String SOURCE_FOLDER = "D:\\demozip\\cms";
public static final String PASSWORD = "12345";
public static void main(String[] args){
try {
System.out.println("dvadvav");
ZipFile z = new ZipFile(OUTPUT_ZIP_FILE);
z.addFile(new File("D:\\demozip\\cms\\build.gradle"));
} catch (Exception e) {
e.printStackTrace();
}
}
}```
Thanks for help!!
CodePudding user response:
In this case I don't use gradle but Using maven it work well