Return-Path: Mailing-List: contact bsf-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list bsf-dev@jakarta.apache.org Received: (qmail 26232 invoked from network); 31 May 2003 11:20:49 -0000 Received: from ny2.fastmail.fm (HELO smtp.us2.messagingengine.com) (66.111.4.3) by daedalus.apache.org with SMTP; 31 May 2003 11:20:49 -0000 Received: from www.fastmail.fm (server1.internal [10.202.2.132]) by server2.messagingengine.com (Postfix) with ESMTP id 4DDE063C96 for ; Sat, 31 May 2003 07:20:47 -0400 (EDT) Received: from 127.0.0.1 ([127.0.0.1] helo=www.fastmail.fm) by messagingengine.com with SMTP; Sat, 31 May 2003 07:20:47 -0400 Received: by www.fastmail.fm (Postfix, from userid 99) id 275DD330C4; Sat, 31 May 2003 07:20:47 -0400 (EDT) Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="KOI8-R" MIME-Version: 1.0 X-Mailer: MIME::Lite 1.2 (F2.71; T1.001; A1.51; B2.12; Q2.03) From: "Igor Bukanov" To: "Bean Scripting Framework developers" Date: Sat, 31 May 2003 13:20:47 +0200 X-Epoch: 1054380047 X-Sasl-enc: +pALSNJdX4in4y9C1KJzTA Subject: Re: Strange Classpath issue. References: In-Reply-To: Message-Id: <20030531112047.275DD330C4@www.fastmail.fm> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Do you call in your IDE Thread.setContextClassLoader()? When Rhino 1.5R3 needs to load generated Java classes, it uses a special classloader that points to Thread.getContextClassLoader() as its parent with hope that it will find find Rhino classes somehow. The default result Thread.getContextClassLoader() gives loader that can load classes from CLASSPATH and lib/ext, but some JVMs may have problems with that. Now if you do not call Thread.setContextClassLoader(), then I believe if you wrap calls to execute scripts into something like ClassLoader old = Thread.getContextClassLoader(); Thread.setContextClassLoader(Loader that knows about directory with jars); try { call script execution } finally { Thread.setContextClassLoader(Loader that knows about directory with jars); } On Sat, 31 May 2003 10:46:24 +0530, "Jiger Patel" 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: bsf-dev-unsubscribe@jakarta.apache.org > >For additional commands, e-mail: bsf-dev-help@jakarta.apache.org > > > > _________________________________________________________________ > Attention NRIs! Send money to India. > http://server1.msn.co.in/msnleads/citibankrca/citibankrca2.asp Do it in a > jiffy! > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: bsf-dev-help@jakarta.apache.org > >