Adding a URL to the ClassPath
Stephen Engwicht <[email protected]> Sat, 30 Apr 2005 07:52:16 +1000
| Newsgroups | gmane.comp.java.beanshell.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I am new to BeanShell so I hope this is not a silly question but I don't
know where else to find info on my problem.
I have embedded the BeanShell interpreter into an applet using
interactive run mode with JConsole. What I am trying to
achieve is to access dynamically created and modified classes and jar
files on the server. As I am developing and testing
on the server, I have been able to add the files to the ClassPath
successfully using addClassPath() with an absolute path
to the files (ie "c:/ServerDirectory/subdirectory"). This works but will
not allow remote access to the new files.
I have tried to add the new files to the ClassPath using
addClassPath(new URL("http://10.1.1.4:8080/ELPv4/test"));
I have printed out the ClassPath and the new url is there;
bsh %> print(getClassPath());
java.net.URL []: {
file:/C:/Program Files/Java/jre1.5.0_01/classes,
file:/C:/Program%20Files/Java/jre1.5.0_01/lib/rt.jar,
http://10.1.1.4:8080/ELPv4/test,
}
but I am unable to access the class in that directory.
I can browse to the directory using my browser, so the file is definitly
accessable from the server. I tried reloadClasses()
and also import *; When BeanShell maps the ClassPath it produces the
following message in the java console;
Start ClassPath Mapping
Not a classpath component: /C:/Program Files/Java/jre1.5.0_01/classes
Mapping: Archive: file:/C:/Program%20Files/Java/jre1.5.0_01/lib/rt.jar
Not a classpath component: /ELPv4/test
End ClassPath Mapping
It seems to have truncated the url to "/ELPv4/test". I don't know what
else to try so any ideas would be appreciated.
Thanks Stephen Engwicht.
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20