Implement a better way to get the URL of the helma.jar file. To be more precise,
do not rely on HOP_HOME to contain the file.
This commit is contained in:
parent
9954933145
commit
b929268fb6
1 changed files with 12 additions and 1 deletions
|
@ -10,6 +10,7 @@ import helma.util.*;
|
|||
import java.util.*;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
/**
|
||||
|
@ -60,7 +61,17 @@ public final class TypeManager {
|
|||
prototypes = new HashMap ();
|
||||
zipfiles = new HashMap ();
|
||||
jarfiles = new HashSet ();
|
||||
URL helmajar = new URL ("file:"+app.home.getAbsolutePath()+"/lib/helma.jar");
|
||||
URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs();
|
||||
URL helmajar = null;
|
||||
for (int i=0; i<urls.length; i++) {
|
||||
String url = urls[i].toString().toLowerCase();
|
||||
if (url.endsWith ("helma.jar")) {
|
||||
helmajar = urls[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (helmajar == null)
|
||||
throw new RuntimeException ("helma.jar not found in embedding classpath");
|
||||
loader = new AppClassLoader(app.getName(), new URL[] { helmajar });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue