This example java program illustrates to get the current working directory (CWD). With the File class object we can get two types of paths in java. These are as follows:
We can get the canonical path by calling the getCononicalPath() with the File class object and for absolute path we can use getAbsolutePath() method.
Here is the full example source code for CurrentWorkingDirectory.java as follows:
Current directory's canonical path: C:\javaexamples
Current directory's absolute path: C:\javaexamples\.
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: October 23, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles