The Vienna Version of BSF4Rexx (Beta) ===================================== ATTENTION - all NEW BEHAVIOUR! - starting with version 250.20050602 you can get and set fields of Java objects as if they were ooRexx attributes; if the case of the field names is significant you need to use the "strict" BSF4Rexx functions/methods to get/set fields in Java objects - by default only the org.apache.bsf (cf ) and ooRexx (cf are supported; the Makefiles allow for using com.ibm.bsf and other Rexx interpreters like Regina; - starting with version 200.20030510 you must not supply any type information - should you need strict typing, then use invokeStrict, registerBeanStrict instead (these allow the supplying of old style type information) BSF4Rexx, version 250.20050602 ("The Vienna Version of BSF4Rexx") Please see also the text file "changesBSF4Rexx.txt" which contains important information about changes (especially to the ooRexx wrapper 'BSF.CLS'). Brief overview ============== BSF allows Java programs to call (invoke) script programs written in languages other than Java. Such script programs are also able to call back into Java and use all of Java's classes and objects. - Hence, any Java application can use (Object) Rexx as a scripting language - Hence, (Object) Rexx can use Java as a huge, operating system independent function library. (The Object Rexx support enabled with "BSF.CLS" makes Java look like a huge Object Rexx class library!) An earlier revision of this version, "The Vienna Version of BSF4Rexx", got partly introduced in April 2005 to the Rexx world at the International Rexx Symposium organized by the Rexx Language Assocation (cf. http://www.RexxLA.org) where it was used for enabling ooRexx to automate (remote control) OpenOffice.org in an openplatform manner. An overview article (dated: 2003-06-01) with short examples can be found at: (and for the forerunner at: ). The "Viennese BSF4Rexx" version adds additional functionality, the most notable addition allows ooRexx programs to address Java fields as if they were Object Rexx attributes, as well as supplying the functions box() and unbox() to wrap and unwrap primitive datatypes into/from their corresponding Java class (e.g. needed for setting property values in OOo). All Rexx programs using BSF4Rexx are per se fully portable, ie. to any system which possesses Java and a Rexx interpreter, provided that the JNI DLL/shared library is ported to that platform (the source file to be ported/compiled is "BSF4Rexx.cc"). Out of the box the following operating systems are supported: Linux (Intel) and Windows. Files and Archives ================== readme.txt ... this file bsf4rexx.zip ... the compiled DLL/shared JNI libraries for Linux, OS/2 (eComStation), Windows; some utility batch files bsf4rexx_samples.zip ... Rexx examples (short programs, *HIGHLY* recommended to look at!), if "readme" files are present, *please* read them before running the examples! bsf4rexx_test.zip ... Rexx test programs (stressing some specific features of BSF4Rexx) bsf4rexx_sources.zip ... contains the needed C++ and Java sources bsf4rexx_javadocs.zip ... javadocs (all in HTML-files) for the Java programs Installation ============ 1) General: Java and Rexx installed ----------------------------------- You need to have Java installed and be able to use the executable called "java": java -version You need to have a supported Rexx interpreter installed, this version recommends the opensoure, openplatform interpreter "ooRexx" available via "http://www.ooRexx.org". rexx -v 2) "bsf4rexx.zip" ----------------- Create a directory "bsf4rexx" and unzip this file which contains the binaries, the Apache BSF, the [oo]Rexx engine for the Apache BSF, the ooRexx wrapper module "BSF.CLS", which makes Java appear like ooRexx itself, and a few testscripts to see whether the installation works. Java uses the environment symbol CLASSPATH to look for Java classes, so we need to tell Java where to start to look for Apache's BSF and the [oo]Rexx engine, ooRexx uses the PATH variable to look for ooRexx modules/programs: under Windows: set CLASSPATH=%CLASSPATH%;x:\full\path\to\bsf4rexx;. set PATH=%PATH%;x:\full\path\to\bsf4rexx\bin Also make sure that the path contains the directory where the Java VM ("jvm.dll") can be found, eg: "C:\Program Files\Java\jre\bin\client", if you have the runtime version of Java installed and Windows is installed on drive c:. (This will allow Rexx to be able to start Java, if necessary!) Alternatively, you can download a Java SDK from Sun (cf. http://java.sun.com) and use the path to the "PATH2SDK\jre\bin\client". under Linux (bash): set CLASSPATH=$CLASSPATH:/full/path/to/bsf4rexx.jar:. set PATH=$PATH;/full/path/to/bsf4rexx/bin (Note the trailing dot, which tells Java to also include the active directory in its search for Java classes.) Further remarks on the Linux installation ----------------------------------------- The following briefly explains how you can successfully set up Java and BSF4Rexx in a Red Hat (Fedora Core 3) environment. It is assumed that you created "bsf4rexx" in your home, so "~/bsf4rexx" can be in this example to refer to it. In this example it is assumed that you run as user "root", so replace that name in path names with your own userid, usually "/home/your-userid". - install ooRexx, which you can get via - install a Java SDK, in this example it will be Sun's Java SDK, version; this example assumes that we are using "j2sdk1.4.2", replace it with the name of your version. export CLASSPATH=~/bsf4rexx:. export PATH=$PATH:~/bsf4rexx/bin ln -sf /usr/java/j2sdk1.4.2/jre/lib/i386/* /usr/lib ln -sf /usr/java/j2sdk1.4.2/jre/lib/i386/client/libjvm.so /usr/lib ln -sf /root/bsf4rexx/bin/libBSF4Rexx.so /usr/java/j2sdk1.4.2/jre/lib/i386/libBSF4Rexx.so ln -sf /root/bsf4rexx/bin/libBSF4Rexx.so /usr/lib/libBSF4Rexx.so ln -sf /usr/java/j2sdk1.4.2/bin/* /usr/bin # --- optional --- ln -sf /usr/java/j2sdk1.4.2/jre/bin/java /usr/local/bin/java 3) "rexxj", "rexxji" and "BSF.CLS" ---------------------------------- The following batch files allow to load/start Rexx programs via Java using Apache's BSF (dubbed "BSF version 2.3" or higher): rexxj.cmd ... Windows rexxj.sh ... Linux The following batch files allow to load/start Rexx programs via Java using IBM's BSF (dubbed "BSF version 2.2") rexxji.cmd ... eCS resp. OS/2, Windows rexxji.sh ... Linux The following Object Rexx program allows Object/ooRexx programmers to treat all of Java as a huge Object Rexx class tree and all Java objects as if they are Object/ ooRexx objects: BSF.CLS ... all operating systems 4) Testing your BSF4Rexx installation ------------------------------------- Issue the following command from the command line for IBM's BSF: rexxj testVersion.rex ... this will first load Java, then have the Java program initialize the scripting support, loading the BSF4Rexx DLL or shared library and handing the Rexx interpreter the program "testVersion.rex" for execution. If everything goes well, you should see the name and version of the Rexx interpreter, the version of the DLL/shared library and the version of the Java Rexx supportive code. Issue the following command from the command line for Object/ ooRexx: rexx testVersion.rex 5) Further infos ---------------- There are archives containing sample programs written in Rexx demonstrating what can be done with BSF4Rexx. bsf4rexx_samples.zip ... contains numerous examples in Rexx (and some in Object Rexx) to show some features possible with BSF4Rexx; *HIGHLY* recommended, short programs a *lot* to be easily learned from! bsf4rexx_test.zip ... contains Rexx test programs to stress test specific features bsf4rexx_src.zip ... source of BSF4Rexx.cc and of the Java Rexx engine 7) Support and questions ------------------------ Please use the main Rexx newsgroup to post questions, example code etc.: news:comp.lang.rexx [Members of the Rexx Language Association (http://www.RexxLA.org) can use the private RexxLA listserver list.] Good luck and have fun! Rony G. Flatscher University of Economics and Business Administration (Wirtschaftsuniversitaet Wien, "WU") 2005-06-03, r3 --- Hints: - In order to use Java as a huge external [oo]Rexx function library you merely need to have the "Java runtime environment (JRE)" installed on your machine. Probably it is installed already, due to support Java applets via your WWW-browser. Otherwise you can download and install Java from: . - You can download the Java API documentation from Sun's Java site. The documentation is merely a set of plain HTML documents that are linked with each other. Alternatively, it is possible to point your WWW browser directly to Sun's Java WWW pages offering the very same documentation: ... Overview page which allows you to choose which Java version's docs you want to browse, e.g. as of 2005-06-04 the following "J2SE API Docs" were accessible: ... Java 1.3 ... Java 1.4 ... Java 1.5 aka Java 5.0 The overview URL also contains plenty of links to tutorials and other valuable Java info material.