Contents | Prev | Next | Index
Canterbury Oberon-2 for JVM can be easily called from a simple command prompt. For example, in order to compile and execute the Slides.java sample on a Windows-95 system, just open a DOS-prompt and enter the following commands (shown here in red color):
C:\COM.webcom.mhc\mhc\obn\samples\slides>java mhc.compiler.obn Slides -m -r Oberon-2 3.0.1 (c) 1999 Mill Hill & Canterbury Corporation, Ltd. Unlicenced time-limited evaluation version Compiling: C:\NEUHOFF\mhc\compiler\runtime\obn\SYSTEM.obn Importing Java class: java.applet.Applet Importing Java class: java.lang.Runnable Importing Java class: java.lang.Thread Importing Java class: java.awt.Image Importing Java class: java.awt.Graphics Importing Java class: java.awt.Event Importing Java class: java.lang.String Importing Java class: java.lang.RuntimeException Compiling: Slides.obn Compilation done: Slides.obn C:\COM.webcom.mhc\mhc\obn\samples\slides>appletviewer Slides.html C:\COM.webcom.mhc\mhc\obn\samples\slides>
As can be seen, the command
java mhc.compiler.obn Slides -m -r
causes the file Slides.obn to be compiled into various *.class files:
Slides.classSlides_ClickAnimation_init_Frame.class
Slides_ClickAnimation.class
The -m switch tells the compiler also to recompile other imported Oberon-2 module files if they are updated. This is like a Make-utility for Oberon-2 files integrated into the Oberon-2 compiler.
The -r switch causes the compiler to write the SYSTEM*.class runtime class into the current working directory. This switch should be used when compiling Java applets, otherwise the runtime class will go into the "mhc\compiler\runtime\obn" directory. The latter may be unaccessable from a Web browser environment.
Module Slides.obn has an Oberon-2 class type called ClickAnimation extending the imported class java.applet.Applet. It also declares some type-bound procedures resulting in an override of some inherited methods. In order to run ClickAnimation, an applet-tag has to be declared in an HTML-document. In this case, file Slides.html has an applet-tag (highlighted in green) as follows:
Slides.html <HTML> <HEAD> <TITLE>A simple click animation applet</TITLE> </HEAD> <BODY> <P> <APPLET CODE="Slides_ClickAnimation.class" CODEBASE=. NAME="A simple click animation applet" WIDTH="170" HEIGHT="170"> </APPLET> </BODY> </HTML>
Calling this file using the JDK appletviewer utility:
appletviewer Slides.html
will launch the Slides_ClickAnimation.class.
Contents | Prev | Next | Index
Canterbury Oberon-2 for JVM (Last documentation update
Jun 2, 2000)
Copyright © 1998 Mill Hill & Canterbury
Corporation, Ltd. All rights reserved
Please send any comments or corrections to
mhc@webcom.com