I am currently making a small simple Java program for my Computer Science Final, which needs to get the path of the current running class. The class files are in the C:\\2013\\g
Try use this code
public game() { String className = this.getClass().getSimpleName(); String testPath = this.getClass().getResource(className+".class"); System.out.println("Current Running Location is :"+testPath); }
visit the link for more information Find where java class is loaded from