07 May 2005
Michael L Brereton
The Ewe Software Development Kit
(SDK)
Setting up your Development Tools
The Ewe
virtual machine executes Java byte-code (i.e. Java programs that have been
compiled into “.class”) files. Therefore you write Ewe programs in the same way
that you write Java programs, by using an Editor or Integrated Development
Environment (IDE) to write source “.java” programs, and then using a Java
Compiler to compile them into “.class” files.
Ewe
programs are different to Java programs in a few respects, but it is important
to remember that Ewe programs can be executed by any Java VM as well as the
Ewe VM. This makes your Ewe applications more portable than any other Java
applications since Ewe VMs exist for platforms for which there are no feasible
Java VMs (e.g. the Casio BE-300 devices).
The
differences between Ewe and Java are:
This is
available for free from the Ewesoft
website and allows you develop Ewe programs on virtually any platform –
including, with a little creativity, some mobile platforms.
Ewesoft strongly
recommends that you use the latest Java SDK (e.g. Java2SE 1.4.2 SDK) from
sun (java.sun.com) to compile and test your
Ewe applications.
The Ewe SDK
comprises the following components – all of which are platform independent:
Not
included in the SDK but available as a separate download:
The Ewe SDK
is a single zip file containing Ewe.jar, Jewel.ewe and JewelData.jar. You
should unzip the SDK into a development directory of your choice on your hard
drive (e.g. C:\ewe or /usr/ewe).
You must
tell your compiler to look in the Ewe.jar file when it is compiling your Ewe
applications. With Sun’s JDK you would include <ewe_directory>/classes/Ewe.jar
in the –classpath option for the javac compiler. e.g.
javac -classpath c:/ewe/classes/Ewe.jar
MyClass.java
With the
Jikes compiler you must do the same:
jikes -classpath
c:/ewe/classes/Ewe.jar MyClass.java
Within the classes
directory of the SDK there is a tests subdirectory with a HelloWorld.java file. Try to compile this using the command
line or your IDE.
If you want to use a Java VM to run your Ewe program, then use the
following command line:
(Windows version) java -cp ewe.jar;./ Ewe
mypackage.MyClass
(Unix version) java -cp ewe.jar:./ Ewe
mypackage.MyClass
To do this
you can use the Ewe VM like this:
ewe mypackage.MyClass
In order
for this to work you will have to have the EweVM directory in the standard
command path, otherwise you will have to specify the full path to the VM.
There are a
number of command line options that you can use when running Ewe programs.
These are generally used to see how your application will work on different
mobile systems. The switches include:
/w
<screen_width_in_pixels> = Limit the
screen width.
/h
<screen_height_in_pixels> = Limit the screen height.
/r = Tell
the VM to consider itself running on a mobile platform.
/p = Simulate a Microsoft PocketPC device or other pen-based device.
/s = Simulate a Microsoft SmartPhone device.
/z = Simulate a monochrome (black & white) system.
/n = Simulate a system that does not support multiple native windows.
/m = Simulate a low memory device.
/l <locale> = Set the default Locale.
/d <directory> = Specify a specific “program
directory”.
/cp <directories> = Specify a ClassPath.
/- = Force the end of VM arguments, all following arguments to be passed
to the application.
The format
for the command line is:
java -cp
ewe.jar Ewe [vm_options] [run_class] [ewe_files] [/-] [application_arguments]
or if you
are using a Ewe VM.
ewe
[vm_options] [run_class] [ewe_files] [/-] [application_arguments]
Examples:
ewe /w 240 /h 320 ewe.ui.Welcome
or
ewe /o
ewesoft.gaming.jigsaw.JigsawPuzzle EwesoftGames.ewe
or
ewe /p eweDemo.ewe
While interpreting the arguments, should the VM come across a .ewe
file before the runtime class name has been specified (as in the third
example above) then it will search that .ewe file looking for a command line
stored within it. If found then that command line will provide the starting
class.
The /- option is only necessary if the first application_argument
happens to be a file with a .ewe extension. Without the /- the VM
will interpret that application_argument as being a .ewe file which contains
application classes and not as an argument for the application. For example the
command line:
ewe ewesoft.apps.HexView
EweConfig.ewe
The EweConfig.ewe file is meant to be viewed by the HexView
application, but the VM interprets EweConfig.ewe as a .ewe library containing
application classes. The HexView application then receives no program
arguments. In this case we will have to use /- as follows:
ewe ewesoft.apps.HexView /-
EweConfig.ewe
Now the VM sees the /- and then passes all following arguments to
the application.