Can anyone show me the correct way to compress and decompress tar.gzip files in java i\'ve been searching but the most i can find is either zip or gzip(alone).
If you are planning to compress/decompress on Linux, you can call the shell command line to do that for you:
Files.createDirectories(Paths.get(target));
ProcessBuilder builder = new ProcessBuilder();
builder.command("sh", "-c", String.format("tar xfz %s -C %s", tarGzPathLocation, target));
builder.directory(new File("/tmp"));
Process process = builder.start();
int exitCode = process.waitFor();
assert exitCode == 0;