Monday, November 10, 2014

How to get the current working directory from Java

package better.faster.smarter.development;

public class HowToFireWebServiceFromJava {

public static void main(String[] args) {
try{
String curWorkingDir = HowToFireWebServiceFromJava.class.getProtectionDomain().getCodeSource().getLocation().getPath();
System.out.println(curWorkingDir);
}
catch(Exception e)
{

}
}
}

No comments:

Post a Comment