- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 Articles
- Golang program to get current working directory
- Get the Current Working Directory in Java
- How to know current working directory in Python?
- How to set the current working directory in Python?
- Java Program to get name of parent directory
- Find out the current working directory in C/C++
- How to display the current working directory in the Linux system?
- Java Program to get the content of a directory
- Java Program to Get Current Date/Time
- Java Program to get name of specified file or directory
- Find the Current Working Directory of a Running Process in Linux
- Java Program to get the name of the parent directory of the file or directory
- How to get the current username and directory in Golang?
- Get Java Home Directory
- Java Program to get current date, year and month

Advertisements