Installing SuperWaba 3.x on Mac OS X to develop for PalmOS

Installing SuperWaba 3.x on Mac OS X to develop for PalmOS

  1. Overview
  2. Installing SuperWaba
  3. Compiling Using SuperWaba
  4. Running Palm Apps as Applets Locally
  5. Other Info
  6. Links

OVERVIEW

Installing the Waba SDK or the SuperWaba SDK allows you to develop software for the PalmOS using a subset of the Java language.

The instructions on this page are based on my install of SuperWaba 3.2.1 on OS X 10.2, and assumes that you are using the tsch shell (default for OS X).

This page is greatly informed by Christopher C. Stump's 'SuperWaba for the Linux Newbie'.

Please if there is something wrong with these instructions, or if there is a better way to have accomplished any of this, or if you have any questions.

[disclaimer]
You can not hold me responsible for anything that might go wrong due to you having visited this web page.

- John Murden


INSTALLING SUPERWABA
  1. Download the latest SuperWaba SDK from http://www.superwaba.com.br/. Once expanded, you end up with a directory 'superwaba'.

  2. Put the directory 'superwaba' somewhere in your file structure that makes sense to you. The example changes below are based on 'superwaba' being placed in /Library/Java/Extensions/ , which is where Apple encourages you to place these kinds of things.

  3. The location of the files in 'superwaba' needs to be added to your environment variable CLASSPATH so that the Java VRM knows where to find these files.

    In Terminal, at your Home, type:

       [command prompt]% pico .tcshrc

    This will open your .tcshrc if it already exists, or create it if it does not already exist. Replacing the bold text with the path to where you have placed the 'superwaba' directory, add the following line (all as one line, no line breaks):

    setenv CLASSPATH "/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar:
    /System/Library/Frameworks/JavaVM.framework/Classes/ui.jar:
    /Library/Java/Extensions/:
    /Library/Java/Extensions/superwaba/classes/:
    /Library/Java/Extensions/superwaba/bin/xplat/superwaba.jar:
    /Library/Java/Extensions/superwaba/bin/:."

    Note the last ':.', this is necessary to include the current working directory in the classpath. Without this addition, compilation will fail.


    Type <control>-O to save what you have just added, and then <control>-X to exit pico.

    Close the Terminal window and open a new one. Doing this causes your new environment variable(s) to be picked up.

    You can confirm your changes by typing:

       [command prompt]% echo $CLASSPATH

    This should echo back the CLASSPATH set above.

COMPILING USING SUPERWABA

With the SuperWaba SDK in place and the classpath properly defined, one can begin developing SuperWaba applications. [ HellowWorld.java ]

In order to test/run this program either on a Palm OS/WinCE device or Palm OS Emulator (POSE), we must transform the .java source code into a Palm OS executable .prc file. This can be accomplished in a few easy steps:

  1. #Change to the directory with the SuperWaba source
    [command prompt]% cd {path to SuperWaba source}

  2. #Compile source
    [command prompt]% javac HelloWorld.java

  3. #Run Warp on the newly created .class files
    [command prompt]% java Warp c HelloWorld HelloWorld.class

  4. #Run Exegen on the .class files
    [command prompt]% java Exegen HelloWorld HelloWorld HelloWorld

Warp is a java program found in /Library/Java/Extensions/superwaba/bin/. Warp's purpose is to create the .pdb files used by Palm OS applications and the .wrp files used by Windows CE devices. We are only concerned with the .pdb file. The first argument to Warp, c, tells the program to create a .pdb file. The second argument is the name of the to-be-created .pdb file, and the third argument is all of the .class program files.

Exegen is a java program that can also be found in same directory as Warp. Exegen's purpose is to create the .prc file, which is the SuperWaba program in Palm OS executable form. The first argument to Exegen is the name of the to-be-created .prc file. The second argument is the name of the main source code file. The third argument is the name of the .wrp file.

If the above steps were successful, a ready-to-use/test Palm OS application should be in the current directory. There should be files called <name<.prc and <name<.pdb (the example above would create HelloWorld.prc and HelloWorld.pdb). Both of these files, along with the SuperWaba virtual machine files, must be installed on a Palm unit or POSE in order to run the application. The SuperWaba virtual machine files can be found in /Library/Java/Extensions/superwaba/bin/palm/ /Library/Java/Extensions/superwaba/bin/xplat/Libraries/ .


NOTE:

You might get the error File Stub.prc not found in classpath when running Exegen. To fix it, open superwaba/bin/PrcFile.java and look for a file path that uses a Windows \\ instead of the / that a *nix system would expect. In my current version, around line # 83 there is the line:

   fis = new FileInputStream(newFile(InputFile.classPath[i],"..\\vm\\palm\\Stub\\Stub.prc"));

Change it to:

   fis = new FileInputStream(new File(InputFile.classPath[i],"../vm/palm/Stub/Stub.prc"));

and recompile. Everything should then be fine.


RUN PALM APPS AS APPLETS LOCALLY

VIEW LARGER: Running a SW program as an applet on the desktop You should now be able to run your new Palm app as an applet on your Mac. In Terminal, cd to the directory of your .class file, and type:

   [command prompt]% java waba.applet.Applet classname

This should cause the Applet runner to open and display your application.

NOTE
Mac OS X 10.2 has hardware acceleration for graphics on by default which can cause display issues with some java programs. To run a SuperWaba applet on the desktop in OS X 10.2, you may need to use:

   [command prompt]% java -Dcom.apple.hwaccel=false waba.applet.Applet classname


OTHER INFO

The above command line arguments can be tedious to type repeatedly while developing. Therefore, it is much nicer to place all of the commands in a simple shell script so everything can be easily run in sequence with a single command. To do this:

  1. Download and uncompress the swm script.

  2. #Change to the directory where you downloaded swm
    [command prompt]% cd {path to swm}

  3. #make the script executable
    [command prompt]% chmod 755 swm

  4. #move the file to you /bin/ directory
    [command prompt]% sudo mv swm /bin

You'll have to log out and back in to be able to use swm. In Terminal, cd to the the same directory as your HelloWorld.java and do the following to automatically compile the HelloWorld.class, run Warp and Exegen, and launch the app as an applet:

   #Invoke shell script to handle SuperWaba app creation
   [command prompt]% swm HelloWorld


LINKS

SuperWaba Home
http://www.superwaba.com.br/

Waba Home
http://www.wabasoft.com/

Waba on SourceForge
http://waba.sourceforge.net/

Waba/SuperWaba discussion
news://news.falch.net/pilot.programmer.waba

Apple Developer Connection - Java
http://developer.apple.com/java/
http://developer.apple.com/techpubs/macosx/Java/java.html

SuperWaba for the Linux Newbie - Christopher C. Stump
http://www.parmly.luc.edu/cstump/www/other/waba-howtos/intro-howto.htm
http://www.parmly.luc.edu/cstump/www/other/waba-howtos/superwaba-howto.htm

Example - SuperWaba 2.x Application as an Applet
http://www.lestercat.net/dev/palm/scribble/

Using SuperWaba on Mac OS X to develop for PalmOS (SW 2.x on OS X 10.1)
http://www.lestercat.net/dev/superwaba/index_2.1.php4



Updated 2002/10/18

.
lestercat.net