Shitu Shitu - 1 year ago 222
Java Question

Uncompress .Z file in unix using java

I have a .Z file present on unix box. Is there any way to call unix uncompress command from java?

Answer Source

Using java.lang.Runtime.exec:

Runtime.exec("uncompress " + zFilePath);


Accoridng to the documentation, ProcessBuilder.start() is preferred.

ProcessBuilder pb = new ProcessBuilder("uncompress", zFilePath);
Process p = pb.start();
// p.waitFor();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download