You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by "Barbisch, Martin" <ba...@sony.de> on 2002/09/19 15:25:39 UTC
Accessing my own Java classes from ECMAScript
Hello Batik users,
I know that it is possible to use the standard Java classes from within the
scripting part of an SVG file. E.g.:
var url = new java.net.URL("file:///c:/somefile.txt");
The question now is: Is it possible to use selfmade classes? E.g.:
var muc = new MyUsefulClass();
I already copied the 'MyUsefulClass.class' file to different directories and
set the CLASSPATH accordingly. Then I started Squiggle (with java -jar
batik.jar) and loaded the SVG file. Result: SVG Error: "MyUsefulClass" is
not defined.
Any ideas?
Cheers,
Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Accessing my own Java classes from ECMAScript
Posted by J Aaron Farr <ja...@yahoo.com>.
Check out the Mozilla Rhino project documentation, for example:
http://www.mozilla.org/rhino/scriptjava.html
might be some help.
Specifically, your javascript for your example would have to look like:
importPackage(Packages.MyUsefulClass);
var muc = new Packages.MyUsefulClass();
You _MUST_ use the "Packages." prefix for any java classes outside the normal
jdk libaries.
Hope this helps.
jaaron
--- "Barbisch, Martin" <ba...@sony.de> wrote:
> Hello Batik users,
>
> I know that it is possible to use the standard Java classes from within the
> scripting part of an SVG file. E.g.:
>
> var url = new java.net.URL("file:///c:/somefile.txt");
>
> The question now is: Is it possible to use selfmade classes? E.g.:
>
> var muc = new MyUsefulClass();
>
> I already copied the 'MyUsefulClass.class' file to different directories and
> set the CLASSPATH accordingly. Then I started Squiggle (with java -jar
> batik.jar) and loaded the SVG file. Result: SVG Error: "MyUsefulClass" is
> not defined.
>
> Any ideas?
>
>
> Cheers,
>
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org