Ewe Application Development

07 May 2005

Michael L Brereton

http://www.ewesoft.com/

 

 

Ewe Application Development 1

Writing Ewe Programs. 1

The Ewe Software Development Kit (SDK) 1

Setting up your Development Tools. 2

Setting up your Compiler. 2

Testing the Compiler. 2

Running your Programs. 2

Command Line Options. 3

 

 

Writing Ewe Programs

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:

 

The Ewe Software Development Kit (SDK)

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:

  1. The Ewe Class Library – Ewe.jar. This file is used as the library class source when compiling Ewe programs and it is used as the runtime class source to run a Ewe Application under Java 1.2. Instructions for using ewe.jar with your Java VM is given here.


  2. The Jewel Program BuilderJewel.ewe and JewelData.jar. These two comprise the Jewel Program Builder. This application is used to package your class files into a single distributable .ewe file. It is also used to convert your application into platform specific executable files (e.g. Windows and WinCE .exe files) or Java .jar files or web Java applets.

Not included in the SDK but available as a separate download:

 

  1. The Ewe API and Ewe Application Development guide – The API is the list of all Ewe classes and methods in HTML format, and the Ewe Application Development guide is this very document.

 

  1. Ewe VMs – running a Ewe application under Java is done using the Ewe.jar  file mentioned before, but to run on any other platform you should download and install the VM appropriate for your system from Ewesoft.com.

  2. A Java Compiler – which you will need to compile your Ewe programs. Again, Ewesoft recommends using the Java SDK available from Sun, but other compilers (such as Jikes) should also work just as well.

Setting up your Development Tools

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).

Setting up your Compiler

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

Testing the Compiler

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.

Running your Programs

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.

 

Command Line Options

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.