File SetExecutable()() Example
A convenience method to set the owner's execute permission for this abstract pathname.
File class SetExecutable()() method example. This example shows you how to use SetExecutable() method.This method is a convenience method to set the owner's execute permission for this abstract pathname.
Here is the code:-
/**
* @Program that set the owner's execute permission for this abstract pathname.
* SetExecutable.java
* Author:-RoseIndia Team
* Date:-30-May-2008
*/
import java.io.*;
public class SetExecutable {
public static void main(String[] args) {
File f = new File("/home/girish/Desktop/girish.txt");
if (f.exists()) {
boolean b = f.setExecutable(true);
System.out.println("set the owner's read permission: "+b);
} else {
System.out.println("File cannot exists: ");
}
}
} |
Output of the Program
| set the owner's read permission: true |
|