I have the following in eclipse
EclipseJavaProject
src/
some.package
Program (+main method)
some.xml
some.other.resource
Note: When running the app, the current dir is set to EclipseJavaProject/ by eclipse
I want to get the path to some.xml and the other resources (relative or absolute). either:
src/some/package/
or
/path-to-workspace/workspace/EclipseJavaProject/src/some/package/
Note: I want the src/ folder in eclipse, because I output files there. I don't want the bin/ folder. Is there a quick way?
So far I have (I don't know how to get the src folder name):
public class C {
public static String C;
public static void main(String[] args) {
System.err.println(C);
}
static {
String command = System.getProperty("sun.java.command");
String dir = System.getProperty("user.dir")+"/src/"+command.substring(0, command.lastIndexOf(".")+1).replaceAll("\\.", File.separator);
C = dir;
}
}