Q:

Write file in java to src directory

I am writing a few files with test results with Java, that I want to check into source control.
The closest method I have found to do this is:
 myclass.class.getProtectionDomain().getCodeSource().getLocation().getPath())

Which will write the file to the class directory in the build.
Is there a trick/quick way that I could write the file to the path that the class is in in the development src folder, rather than the build directory?

A:

Better pass path to src dir thru system property. You can read it by System.getProperty("name") and pass to your program by -Dname=value command line argument.

