javascript + gcj

Anthony Green green@redhat.com
Sat Oct 6 17:28:00 GMT 2001


FYI... I've just imported the Netscape/Mozilla javascript package (rhino) into
rhug.
In addition to the main library, lib-org-mozilla.so, it will install two
programs...
 js - a javascript shell
 jsc - a javscript compiler for generating .class files (compilable with
gcj)
javascript is actually kind of cool. It looks quite practical as a general
scripting language because the gcj runtime loads relatively quickly. Here's a
javascript version of libjava/scripts/showval.java, for instance..
---- cut here -----------------------------------------
#!/usr/local/bin/js
ch = arguments[0].lastIndexOf ('.');
className = arguments[0].substring (0, ch);
constName = arguments[0].substring (ch + 1);
klass = java.lang.Class.forName (className);
field = klass.getField (constName);
print (constName + " = " + field.getInt (null));
---- cut here -----------------------------------------
AG


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /