Excellent tip. Things seem to be working fine but I am giving a few more days to give a final verdict since it was working fine previously too but failing sometimes. But I assume it works. Now teo questions
1. When and who will update the Javascript BSF engine to the latest Rhino releases (Rhino 1.5R4.1) or it is already done in the CVS. if so when is the next BSF release expected?
2. How can I further optimze the below chunk of code. That is, instead of setting the CL for every execution, what are the other ways I could follow to say set the CL only once and never set-unset it. Would it affect the classes of the IDE or other plugins.
Thanks and awaiting your replies, -Jiger
Do you call in your application Thread.setContextClassLoader()? If not, wrapping calls to execute scripts into something like
ClassLoader old = Thread.getContextClassLoader(); Thread.setContextClassLoader(Loader that you use to load js.jar); try { call script evaluation } finally { Thread.setContextClassLoader(old); }
then it should help Rhino 1.5R3. It uses Thread.getContextClassLoader() as a parent loader for generated classes and if that loader can not find Rhino classes, you will get exactly the problem you described.
Regards, Igor.
On Sat, 31 May 2003 10:46:24 +0530, "Jiger Patel" <[EMAIL PROTECTED]>
said:
> Hi Igor,
> >
> >Did you install JavaScript js.jar into lib/ext dir in the jdk
> >distribution? If so, you should add it to your classpath as well.
>
> Well I have not put any js.jar in the lib/ext. Actually I am writting
> this
> plugin for an Open source IDE that provides scripting support for various
> scripting engines using BSF. So the plugin jar, the bsf.jar and the
> languages jar files are in the IDE's jars directory. Now when the IDE
> starts
> up, it adds ALL the jar inside the "jars" directory to its CL. Thus a
> plugin
> can access any jar if it is in the "jars" directory. But javascript and
> jython are the two languages that are reciprocal of each other. One loads
> fine if I don't touch the classpath(sys property java.class.path) or the
> IDE's ClassLoader the other (jython) does not recognise the current CL
> but
> only recog. classes either directly added to it via
> sys.packageManager.addJar() method. so what I have temporarily done is
> load
> nothing if language is other than Jython. And if the user selects Jython
> in
> the dropdown, then I call the Jython hack class which would add ALL the
> jar
> inside the "jars" directory to sys.packageManager. Now the funniest part
> is
> that sometimes, no matter what, everything works perfectly fine using the
> above method, but sometimes(if I figure out the steps then wud let you
> know
> too but right now it is abrupt) Javascript behaves funny and gives me
> NoClassDefFound:org/mozilla/javascript/NativeScript. This is really
> un-intutive and I hope the BSF engine for Javascript is updated for the
> latest rhino specs(I think it is Rhino 1.5R4.1). THe newer version
> complains
> about some Debugger class not found. So I am using sometimes-workable
> rhino
> 1.5R3 which is giving me this strange behaviour.
>
> Any tips.
>
> -Jiger
>
>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _________________________________________________________________
> Attention NRIs! Send money to India.
> http://server1.msn.co.in/msnleads/citibankrca/citibankrca2.asp Do it in a
> jiffy!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Race along with NK. The fastest Indian http://server1.msn.co.in/sp03/tataracing/index.asp Feel the thrill!
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
