Java examples for File Path IO:File Attribute
Determine if a file can be written
import java.io.*; public class Main { public static void main(String[] args) { String filePath = "C:/Folder/ReadText.txt"; File file = new File(filePath); if(file.canWrite()) {//from www .j a v a2 s.c o m System.out.println("File " + file.getPath() +" can be written"); } else { System.out.println("File " + file.getPath() +" can not be written"); } } }