A java blog with a collection of examples and tutorials on Java and related technologies. (Under maintenance with continuous updates)
Be in touch with java jazzle or k2java.blogspot.com.
Pages
▼
Tuesday, April 19, 2011
How to get the parent directory of a file in java?
Use file.getParent() method for this:
File file = new File("C:/File/demo.txt");
String strParentDirectory = file.getParent();
No comments:
Post a Comment