Java Support (The Unified Virtual Machine)
Overview
The Smalltalk/X virtual machine (runtime system) allows for Java code
to be integrated and executed within the Smalltalk environment.
This integration is virtually seamless - from a programmers point
of view, there is no difference between a smalltalk object and a java
object. Java classes inherit from Object - much like most other smalltalk
classes.
This allows for java classes to be loaded into the system and used
in the same way as smalltalk classes.
Prerequisites
You need the Java JDK classfiles (we recommend jdk1.1.6)
to be installed on your system.
There is no need for a java virtual machine to be installed, since
ST/X includes its own java interpreter, JIT and support system.
Limitations
JDK 1.2.x and above are not (yet) supported.
Implementation
see the paper and slides on our webServer.
Startup
- get a JDK (usually you will already have it on your machine)
- if you want to embed Java applets in smalltalk applications,
you need an old 3.0 mozillas MozillaAppletContext class.
(Sorry for that, but we have not yet written our own AppletContext
stub class, and the JavaVM currently emulates an old Mozillas
interface ...)
This will change in the future.
You need to grab the file ns30_unix.zip
from some
Netscape3.0 distribution.
If netscape agrees, we can distribute that file in the future.
- load the java support classes:
This is optional - the java classes should autoload when required;
However, autoloading is slower than package loading.
Smalltalk loadPackage:'stx:libjava'
This should also load in many of the java classes as they are pulled
into the system during java classInitialization time.
- switch to the JAVA namespace in the browser.
- see them classes.
If the java classes are not found, have a look at the method
Java class initialize
, where the various JDK versions are probed.
In a workspace, you can test java-class loading by evaluating:
Java classForName:'java.lang.Object'
this should return a (non-nil) java class object.
Notice, that the ST/X classLoader is not yet able to extract class
files from a compressed zip archive. If in doubt, unzip the "classes.zip"
file into individual files using "winzip.exe" or "unzip".
Restricted use
As we provide these classes for no additional charge,
we request that any changes/modifications & enhancements
made to them be returned to us (in source), to be reintegrated
into future versions.
This code is NOT public domain code, but provided for free
with the ST/X system.
You are not allowed to sell this code or any application built around this
code unless special agreements are set up.
(However, you are allowed to use this tool for your own applications)
No Warranty
Java support is provided AS-IS without any warranty whatsoever.
Origin/Authors
Authors:
Claus Gittinger (eXept)
<info@exept.de>
Doc $Revision: 1.9 $