

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to Get Current Working Directory
The java.lang.System.getProperty(String key) method gets the system property indicated by the specified key. You can get the current directory path bypassing the string value "user.dir" to this method.
Example
public class Main { public static void main(String[] args) { String curDir = System.getProperty("user.dir"); System.out.println("You currently working in :" + curDir+ ": Directory"); } }
Output
You currently working in :C:\Documents and Settings\user\ My Documents\NetBeansProjects\TestApp: Directory
- Related Questions & Answers
- Get the Current Working Directory in Java
- How to know current working directory in Python?
- How to set the current working directory in Python?
- Find out the current working directory in C/C++
- How to display the current working directory in the Linux system?
- Java Program to get name of parent directory
- Java Program to Get Current Date/Time
- Java Program to get the content of a directory
- Get Java Home Directory
- How to get the current username and directory in Golang?
- Java Program to get name of specified file or directory
- Java Program to get current date, year and month
- Java Program to get the name of the parent directory of the file or directory
- How to find current directory of program execution in Python?
- How to change current directory using Python?
Advertisements