For example: our program contains the resource A and class MyClass
src
main
java
MyClass
resource
A
When we package our program, A will be at root.
To get the absolute path to resource(for example when we want to do unit test
and load those resource for test), we will call
String path = MyClass.getClass.GetResource("/A").toURI().getPath();
And now we have the absolute path to resource.