List of usage examples for java.io File File
public File(URI uri)
From source file:Main.java
public static void main(String[] args) { File f = new File("C:/test.txt"); // set read permission boolean bool = f.setReadable(true, true); System.out.println("setReadable() succeeded?: " + bool); // checks whether the file is readable bool = f.canRead();/* ww w.j a v a 2 s .c om*/ System.out.print("Is file readable?: " + bool); }
From source file:MainClass.java
public static void main(String[] a) throws Exception { File file = new File("c:\\test\\test.txt"); file.createNewFile();//from ww w. ja v a2 s.c o m }
From source file:Main.java
public static void main(String[] args) throws Exception { File file = new File("C:/Demo.txt"); System.out.println(file.delete()); }
From source file:MainClass.java
public static void main(String[] args) { System.out.println(new File("home").mkdir()); }
From source file:Main.java
public static void main(String[] args) { File f = new File("test.txt"); // set executable() boolean bool = f.setExecutable(true, true); System.out.println("setExecutable() succeeded?: " + bool); // can execute bool = f.canExecute();/*w ww. j a v a2s.c o m*/ System.out.print("Can execute?: " + bool); }
From source file:Main.java
public static void main(String[] argv) throws Exception { File file = new File("dir" + File.separatorChar + "filename.txt"); file = file.getAbsoluteFile();/*from ww w.jav a2 s . co m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { File file = new File("filename.txt"); file = file.getAbsoluteFile();/*from w w w .j av a2 s . c om*/ }
From source file:Main.java
public static void main(String[] args) throws Exception { File file = new File("C://demo.txt"); boolean blnCreated = false; blnCreated = file.createNewFile();/* ww w.ja v a 2 s. c om*/ System.out.println(blnCreated); }
From source file:Main.java
public static void main(String[] argv) throws Exception { File file = new File(".." + File.separatorChar + "filename.txt"); file = file.getAbsoluteFile();/*from w ww. ja v a 2 s . com*/ }
From source file:Main.java
public static void main(String[] args) { File file = new File("config.xml"); int errCode = 0; if (!file.exists()) { errCode = 1;//from ww w . j av a2 s . c om } else { errCode = 0; } // When the error code is not zero go terminate if (errCode > 0) { System.exit(errCode); } }