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