Java File Attribute setExecute(String path)

Here you can find the source of setExecute(String path)

Description

set Execute

License

Open Source License

Declaration

public static boolean setExecute(String path) 

Method Source Code

//package com.java2s;
/*//from   www. j a v  a2s .  c  o m
 *
 * This file is part of Jupidator.
 *
 * Jupidator is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 2.
 *
 *
 * Jupidator is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Jupidator; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

import java.io.IOException;

public class Main {
    public static boolean setExecute(String path) {
        try {
            Process proc = Runtime.getRuntime().exec(new String[] { "chmod", "a+x", path });
            proc.waitFor();
            return true;
        } catch (InterruptedException ex) {
        } catch (IOException ex) {
        }
        return false;
    }
}

Related

  1. setExecutable(File f, final String pattern)
  2. setExecutable(File file)
  3. setExecutable(File file, boolean executable)
  4. setExecutable(String filesList)
  5. setExecute(File f, boolean b)
  6. setExecutePermissions(final File scriptfile)
  7. setRecursiveExecutable(File path)
  8. setSharedPermissions(File file, boolean setExecutable)
  9. shellExecute(String strCommand)