Re: [Objectscript-users] Embedding java. Examples.
Brought to you by:
rob_d_clark
From: Rob C. <ro...@ti...> - 2005-09-13 05:17:40
|
There are a couple caveats with dealing with java packages... 1) pkg.system.declareJavaPackage() is a bit simplistic... if you declare "a.b.c" this does not automatically declare the existence of "a.b"... one of these days, maybe I'll fix this... or maybe Sun will come up with a more reliable way to detect the existence of some java package so there would be no need for this ugly hack in the first place. So you would (potentially) need to have something like: pkg.system.declareJavaPackage("com.novatechnolgias"); pkg.system.declareJavaPackage("com.novatechnolgias.xf"); If someone out there knows any reliable way to detect the existence of a package, please let me know... unfortunately it seems that java.lang.Package.getPackage() only works if some java class from that package has already been accessed from the java environment. 2) being in the system classpath is different from an "import"... ie. you still need to use a fully qualified package name, or an import, ie: var pp = new com.novatechnolgias.xf.pruabmBsh(); or: mixin(com.novatechnolgias.xf); var pp = new pruabmBsh(); 3) is xf.javax.swing.JMenuItem the full package + classname? Or is it com.novatechnolgias .xf.javax.swing.JMenuItem? If the former, then you will need to create a new JavaPackage object for the "xf" package root: const var xf = new JavaPackage("xf"); if the later, you will need something like: const var xf = com.novatechnolgias.xf; (after the necessary pkg.system.declareJavaPackage stuff) -- Rob On Sep 12, 2005, at 11:32 AM, Sergio Szychowski wrote: > Hi, > > I trying to embed some scripts files but I have some errors and I > can't > figure how to fix them. > > > Some examples. > > > > var pp = new pruabmBsh(); /* pruabmBsh belongs to > com.novatecnologias.xf > package, and is in the system classpath */ > oscript.exceptions.PackagedScriptObjectException: > NoSuchMemberException: > no such member: (global): pruabmBsh > at /u/jbproject/NovaTecnologiasXForms/javax/abm_cli.os:3 > > var jmi_nuevo=new xf.javax.swing.JMenuItem(); > > oscript.exceptions.PackagedScriptObjectException: > NoSuchMemberException: > no such member: (global): xf > at /u/jbproject/NovaTecnologiasXForms/javax/abm_cli.os:22 > > > I trying with JavaPackage() and pk.system.declareJavaPackage > but always the same error, or similar ( xf no such member, javax no > such member, novatecnologias no such member, etc). > > > Greetings > > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > Practices > Agile & Plan-Driven Development * Managing Projects & Teams * > Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/ > bsce5sf > _______________________________________________ > Objectscript-users mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectscript-users > |