public static String makeRelative(final String path,final String base){
  if (path.startsWith("/")) {
    return path;
  }
 else {
    final int lastSlash=base.lastIndexOf('/');
    if (lastSlash >= 0) {
      return base.substring(0,lastSlash + 1) + path;
    }
 else {
      return path;
    }
  }
}

public static String makeRelative ( final String path , final String base ) { if ( path . startsWith ( "/" ) ) { return path ; } else { final int lastSlash = base . lastIndexOf ( '/' ) ; if ( lastSlash >= 0 ) { return base . substring ( 0 , lastSlash + 1 ) + path ; } else { return path ; } } }
makes the specified path relative to the specified base path .
