Java File Attribute ensureExecutable(final File file)

Here you can find the source of ensureExecutable(final File file)

Description

ensure Executable

License

LGPL

Declaration

public static void ensureExecutable(final File file) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.io.File;

public class Main {
    public static void ensureExecutable(final File file) {
        if (!file.canExecute() && !file.setExecutable(true)) {
            throw new IllegalStateException(String.format(
                    "Failed to set %s executable", file.getAbsolutePath()));
        }//www  .  j av a2 s  . c  o  m
    }
}

Related

  1. checkIfExecutableIsInPATH(final String executableName)
  2. doesExecutableExist(String executablePath)
  3. ensureExecutable(IPath path)
  4. ensureFileIsExecutable(String filename)
  5. fileExecute(String path)
  6. findInPath(String executable, String path, String pathSeparator)