Create a new File, which will create a file in the directory of the jar, then get the path from there


File file = new File("temp");
String path =file.getParentFile().getAbsolutePath();