How do I get the directory where the a .java file is located? I don't want to use System.getProperty("user.dir"), because that gives me the directory of the executable, and not the directory of the .java file that contains this line of code.
I need this because I'm developing a JSP web-app, and the Java code creates a .csv file on the server side and I want to make it available on the client side, but I would need to place the csv file where the location of the .html files are so that they could be downloaded.
My current folder structure is like:
Java Resources ->src
->.java file
WebContent
->.html file
System.getProperty("user.dir")gives you the directory you launched the executable from. A.javafile does not exist at runtime.