Here you can find the source of chmod(final String path, final String mode)
public static void chmod(final String path, final String mode) throws Exception
//package com.java2s; //License from project: Apache License public class Main { public static void chmod(final String path, final String mode) throws Exception { final String[] cmdarray = new String[] { "chmod", mode, path }; Runtime.getRuntime().exec(cmdarray, null, null); }//from w w w. j a v a 2 s . co m }