I know there are lots of similar questions out there, but none of which that helped. We have a GWT application running on a tomcat server, which is loading a properties file for
Wo do nearly the same here with "Packager.class" as a class in the same directory; The idea here is to find the path via the class path, which works on tomcat:
final ClassPool pool = ClassPool.getDefault( );
final Class> baseClass = Packager.class;
pool.insertClassPath( new ClassClassPath( baseClass ) );
final URL url = pool.find( baseClass.getName( ) );
String pathToBaseClass = url.toURI( ).getPath( );
String baseDir = pathToBaseClass.substring( 0, pathToBaseClass.indexOf( "com" ) - 1 );