JRuby Bridge Tutorial - Overview of the Example Application

The example application shown here consists of 3 Java classes, and 4 Ruby script files, 2 of them containing the definition of Ruby classes.

The Java classes:

Jmain Contains the main method.
hostenv.HE Represents in our application a "class in the Java world". No Ruby here.
vp.VP The Java side of the Red Bridge. Methods in this class create objects defined on the Ruby side, invokes their methods and evaluates their response.

The Ruby classes:

Asahi A class which I use to demonstrate various ways of information passing between Java and Ruby. Processes and creates Java objects.
Kirin A class which I use to demonstrate the handling of general UTF-8 strings.

The Source Files (pathes relative to project directory)

jsrc/Jmain.java Definition of class Jmain. Uses class vp.VP.
jsrc/HE.java Definition of class HE in package hostenv. Used by class vp.VP.
jsrc/VP.java Definition of class VP in package vp. Used by class Jmain. Uses class hostenv.HE and the Ruby classes. This is the Java side of the Red Bridge.
rbsrc/bridge.rb The Ruby side of the Red Bridge. This is where all the stuff in the Ruby world gets initialized. Creates a global variable of the (Ruby-)class Kirin and returns an object of the (Ruby-)class Asahi. Also outputs some messages, when it is executed - just to demonstrate, when exactly this code is run.
rbsrc/vpruby.rb The sole purpose of this script is to demonstrate one way to make a bunch of Ruby files available to an application.
rbsrc/asahi.rb Definition of class Asahi. Uses the Java class hostenv.HE.
rbsrc/kirin.rb Definition of class Kirin .
MANIFEST.MF Since this toy-application is delivered as jar archive, a manifest file needs to be included in the archive. The name is arbitrary - the file will be flagged as being "the manifest" when creating the archive - but it is common to name it that way.
jr8.bat A Windows batch file, which compiles and runs the application. Depending on its arguments, the application consists either of a single jar file (containing JRuby and our application), or our application only (i.e. JRuby being in a separate jar file).
????/lib/jruby-complete.jar This is JRuby itself - this files becomes part of the application to be delivered. Its location depends on where you install JRuby. In my case, I installed it to c:\dl, so it would be c:\dl\jruby-complete-1.7.23.jar. If you actually want to run this example, you have to adust the setting of the variable JRUBY_JAR in jr8.bat accordingly.

You can download the example.