Obtaining the Java Execution Path - Java Native OS

Java examples for Native OS:Environment

Introduction

Invoke the System class's getProperty method. For example:

Demo Code

public class Main {
  
  public static void main(String[] args) throws Exception {
    String  path = System.getProperty("user.dir"); 
    System.out.println(path);// w  w w  .  j  av a 2  s  .  c  o m
  }
}

Related Tutorials