J2F Proof of Concept (Flex 3, Java)


This is a barebones, hacked-up, quick-and-dirty proof of concept to see if we can embed the Waba (http://www.wabasoft.com/) virtual machine inside Flash Player using Alchemy from Adobe Labs (http://labs.adobe.com/technologies/alchemy/).

All code is GPL except where otherwise indicated.

This is tested on Cygwin / Windows.

This POC (Proof of Concept) builds WabaTest.swf, which is a Flex program which embeds a reduced Waba Virtual Machine (no UI, I/O, etc.) and a small Java program (test/Hello.java). You invoke the exec() method of class Hello via the [Submit] button. You can do this repeatedly to see that instance persists across button presses. The contents of the Input text field are currently ignored.

(Disclaimer: In Hello.exec(), I know you're supposed to use StringBuffer / StringBuilder for concatenation. Just wanted to keep it simple to start out with.)

Lookie Here!

This is the real, running program, not a screenshot!

You'll need the Adobe Flash Player to see this.

The Waba sources and waba.wrp file are adapted from my Waba for DOS distribution at http://www.thisiscool.com/doswaba.htm

Both Hello.class and the contents of waba.wrp are hardcoded and embedded into the Waba sources via Waba/jutil/FileToC. This is done during the build process.

Here are what I hope to be reproducible instructions for building WabaTest.swf. Like I said, I did this under Cygwin/Windows and your mileage may vary under other OSes. (Feel free to buy consulting time if you want me to verify this on OS X / Linux.)

  1. Download and install Alchemy and its dependencies as per this: http://labs.adobe.com/technologies/alchemy/ I'm using Cygwin, Java 1.6.0_11 and alchemy-cygwin-v0.5a For the record, I added this line to alchemy-setup:
       export ADL="$FLEX_HOME/bin/adl.exe"
    ...and these lines to ~/.bashrc:
       export FLEX_HOME=/cygdrive/c/PROGRA~1/flex_sdk_32
       export ALCHEMY_HOME=/cygdrive/c/PROGRA~1/alchemy-cygwin-v0.5a
       source /cygdrive/c/PROGRA~1/alchemy-cygwin-v0.5a/alchemy-setup
       export PATH=$ALCHEMY_HOME/achacks:$FLEX_HOME/bin:$PATH
  2. Fix hacks.pl as per this post: http://forums.adobe.com/thread/201580
  3. Get http://static.thisiscool.com/gnustuff/j2f_20090722.tar.gz and unarchive it somewhere. My location is C:\Data\Programs\flex\J2F
  4. Run build.sh in the J2F folder.

If everything goes well, you should get a bunch of warnings as well as a built WabaTest.swf. Like I said, this is a hacked-up first attempt just to see if this works (and it seems to!)

I don't have time to field questions about this unless you buy consulting time.