Table of Contents
Abstract
The Smalltalk/X virtual machine (runtime system) allows for Java code to be 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, giving Smalltalk/X user access to vast amount of Java libraries.
TBW...
STX:LIBJAVA is a part of Smalltalk/X. To load it into a Smalltalk/X environment, execute following:
Smalltalk loadPackage: #'stx:libjava'. Smalltalk loadPackage: #'stx:libjava/tools'.
Before any user Java code can be loaded and executed, the
STX:LIBJAVA has to be initialized. During the initialization, basic
classes are loaded and initialized - such as
java.lang.Object
,
java.lang.String
. To initializa Java in running Smalltalk/X, execute:
JavaVM boot.
You may later shutdown or reboot Java by:
JavaVM shutdown. JavaVM reboot.
During shutdown, all pure-Java threads are uncoditionally terminated and Java classes are unloaded. This may have funny consequences, especially when a Smalltalk thread is actually executing a Java code and it may be manifested in weird way. The shutdown is here mainly for development purposes - in an application, you shouldn't do a Java shutdown. If you do, result is undefined.