This is the mail archive of the rhug-rhats@sources.redhat.com mailing list for the RHUG project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

javascript + gcj


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]