I am trying to get current directory of my Project from java. I am using the following lines of codes to get the path details.
Type 1:
File directory
you can use this code
String absolutePath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); absolutePath = absolutePath.substring(0, absolutePath.lastIndexOf("/"));
this code is working before for me! it will return the full path of folder in windows or linux.