* URL-decode installation directory since it may have been derived
from a jar-URL. * Exit if installation directory could not be determined. * Print a message to stderr for each extension jar that is added to the classpath.
This commit is contained in:
parent
31ccc12e5b
commit
da936baf1e
1 changed files with 8 additions and 1 deletions
|
@ -4,6 +4,7 @@ package helma.main.launcher;
|
||||||
|
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FilenameFilter;
|
import java.io.FilenameFilter;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
@ -64,9 +65,13 @@ public class Main {
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
// unable to get Helma installation dir from launcher jar
|
// unable to get Helma installation dir from launcher jar
|
||||||
System.err.println ("Unable to get Helma installation directory: "+x);
|
System.err.println ("Unable to get Helma installation directory: "+x);
|
||||||
|
System.exit (2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// decode installDir in case it is URL-encoded
|
||||||
|
installDir = URLDecoder.decode (installDir);
|
||||||
|
|
||||||
// set up the class path
|
// set up the class path
|
||||||
File libdir = new File (installDir, "lib");
|
File libdir = new File (installDir, "lib");
|
||||||
ArrayList jarlist = new ArrayList ();
|
ArrayList jarlist = new ArrayList ();
|
||||||
|
@ -83,13 +88,15 @@ public class Main {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (files != null)
|
if (files != null)
|
||||||
for (int i=0;i<files.length; i++)
|
for (int i=0;i<files.length; i++) {
|
||||||
// WORKAROUND: add the files in lib/ext before
|
// WORKAROUND: add the files in lib/ext before
|
||||||
// lib/apache-dom.jar, since otherwise putting a full version
|
// lib/apache-dom.jar, since otherwise putting a full version
|
||||||
// of Xerces in lib/ext would cause a version conflict with the
|
// of Xerces in lib/ext would cause a version conflict with the
|
||||||
// xerces classes in lib/apache-dom.jar. Generally, having some pieces
|
// xerces classes in lib/apache-dom.jar. Generally, having some pieces
|
||||||
// of Xerces in lib/apache-dom.jar is kind of problematic.
|
// of Xerces in lib/apache-dom.jar is kind of problematic.
|
||||||
jarlist.add (jars.length-3, new URL ("file:" + files[i].getAbsolutePath()));
|
jarlist.add (jars.length-3, new URL ("file:" + files[i].getAbsolutePath()));
|
||||||
|
System.err.println ("Adding to classpath: "+files[i].getAbsolutePath());
|
||||||
|
}
|
||||||
URL[] urls = new URL[jarlist.size()];
|
URL[] urls = new URL[jarlist.size()];
|
||||||
jarlist.toArray (urls);
|
jarlist.toArray (urls);
|
||||||
FilteredClassLoader loader = new FilteredClassLoader (urls);
|
FilteredClassLoader loader = new FilteredClassLoader (urls);
|
||||||
|
|
Loading…
Add table
Reference in a new issue