public class Demo {
public static void main(String[] args) {
String path = File.separator + "home" + File.separator + "admin" + File.separator + "zlib_decompress"; // zlib_decompress 路径
String template = "chmod 777 %s";
String command = String.format(template, path);
String[] cmd = new String[] { "/bin/sh", "-c", "chmod 777 %s" };
try {
Runtime.getRuntime().exec(cmd); // chmod 777 /home/admin/zlib_decompress
} catch (Exception e) {
e.printStackTrace();