Replacing a string with the file name

I want to have source files copied over into a directory that can replace tokens in them, but I also want to replace something like FILE_LOCATION with the absolute path. For example, in /home/ramidzkh/test/me/ramidzkh/test/ I had java private static final String FILE = "FILE_LOCATION"; I want it to turn into ```java
private static final String FILE = “/home/ramidzkh/test/me/ramidzkh/test/”;

If it were me, I’d just have a SOURCE_ROOT which is the same for everything and a getSourceFile() which is class specific. Eg:

public class Test {
    public static final File SOURCE_ROOT = new File("${sourceRoot}");

    public File getSourceFile() {
        String path = getClass().getName().replace('.','/') + ".java";
        return new File(SOURCE_ROOT, path);

Then you can use a similar technique as the following SO answer