java get current directory code example
Example 1: python get username
import os
username = os.getlogin()
Example 2: how to get current directory in java
public class JavaApplication {
public static void main(String[] args) {
System.out.println("Working Directory = " + System.getProperty("user.dir"));
}
}
Example 3: get file path java
File file = new File("yourfileName");
String path = file.getAbsolutePath();
Example 4: python get parent directory
from pathlib import Path
Path('C:\Program Files').parent