# Java Examples (Running ooRexx Scripts from Java)

Hint: if you wish to look at the ooRexx code with syntax highlighting, then you can use the free and open-source editor `"[g]vim"`, which is available for practically all platforms and can be downloaded from its homepage at http://www.vim.org/.

. <directory> (List of this directory)
  Display all of this directory's files and directories.
.. <directory> (List of parent directory)
  Display all of the parent directory's files and directories.
handlers <directory>
  Root of Rexx handler samples (cf. "rexxapi.pdf", sections 1.15. Rexx Exits Interface and 1.16. Command Handler Interface).
InvokeRexxFromJava.java
  A Java demonstration program to show, how easy it is to invoke a Rexx program, supply arguments to it and retrieve a return value.
JavaRunRexx_01.java
  Demonstrate how to invoke an ooRexx program and supply it a Java object to interact with. [NetRexx version: nrxRunRexx_01.nrx.]
JavaRunRexx_02.java
  Demonstrate how to invoke an ooRexx program and supply it a Java object to interact with. This version first causes the ooRexx package `BSF.CLS` to be loaded into the ooRexx interpreter instance, such that the next ooRexx script that gets executed already has full access to the public classes and routines of the `BSF.CLS` ooRexx package. [NetRexx version: nrxRunRexx_02.nrx.]
JavaRunRexx_03.java
  Demonstrate how to interact with a Rexx object from Java. [NetRexx version: nrxRunRexx_03.nrx.]
JavaRunRexx_04.java
  Demonstrate how to fetch and interact with a Rexx condition object from Java. [NetRexx version: nrxRunRexx_04.nrx.]
JavaRunRexx_05.java
  Demonstrate how to setup a `.host` directory in Rexx from Java, which then receives Java objects for use in Rexx programs; in addition a value is saved in `.host` by Rexx under the index `REXX.HEY` that upon return is fetched from Java. [NetRexx version: nrxRunRexx_05.nrx.]
JavaRunRexx_06.java
  Demonstrate how to use the context of a Rexx routine (i.e. all public routines and public classes available to it) for another Rexx routine.
  The first routine requires `BSF.CLS` which adds public routines and public classes which then are made available to Rexx routines that get created and executed later via Java. In addition the ooRexx standard streams get redirected to the Java standard streams by calling the public routine `bsf.redirectTo`.
  Then another Rexx routines gets defined to use the first package, and in addition defines a public routine named `test`.
  Finally, the last Rexx routine demonstrates getting access to the package of the second routine which makes its public routine named `test` accessible. In addition the last routine is called twice, once without Java supplied arguments, once with Java supplied arguments. [NetRexx version: nrxRunRexx_06.nrx.]
javax.script (a.k.a. "jsr-223": "Java Specification Request 223", the expert group that defined the Java scripting framework)
  Demonstrates how to take advantage of the Java scripting framework (cf. Java package e.g. at "javax.script") introduced with Java 6.

Rony G. Flatscher, 2010-08-23 - 2022-08-29, Wien/Vienna, Austria, Europe