-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
This is probably a Windows specific issue.
Suppose java is located here
C:\Program Files\Java\jre1.8.0_91
getRTJarPath() returns this String:
/C:/Program%20Files/Java/jre1.8.0_91/lib/rt.jar
getBootClassPath() uses the String to create a URL from
a File (line 659). But
- new File("/C:/Program%20Files/Java/jre1.8.0_91/lib/rt.jar")
is not a valid File. - new File("/C:/Program%20Files/Java/jre1.8.0_91/lib/rt.jar").toURI()
produces
file:/C:/Program%2520Files/Java/jre1.8.0_91/lib/rt.jar
which is a corrupt URI. toURI() wants to encode the '%' character
without realizing that the space character has already been
encoded. To be expected because File does not recognize encoded
characters.
toURL() propagates the error.
searchJarForClasses() tries to URL.openStream() and it fails.
Try this:
cp = this.namespace.getClassManager().getClassPath();
cp.getClassSource("java.lang.Object");
It returns null.
Possible Solutions
(1.) Do
urlString.replaceAll("%20", " ");
before returning from getRTJarPath(). This handles encoded space characters in
the path. There could still be other encoded characters though.
(2.) Create the URL directly from getRTJarPath().
public static BshClassPath getBootClassPath()
throws ClassPathException {
...
URL url = new URL("file:" + getRTJarPath());
...
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels