(zdia 10/2011) The conditions of this feasibility study were * Linux Salix based on Slackware 13.37 with Xfce * Android emulator with Api 8 (v. 2.2) * javac 1.6.0_25 * Android SDK r14: http://dl.google.com/android/android-sdk_r14-linux.tgz * JTcl-2.0.0 * Apache Ant(TM) version 1.8.2 ***Create the projects folders*** Create an Android project with something like: ======none $ android create project \ --package tcl.lang \ --activity JTcl \ --target 1 \ --path ~/Projekte/jtcl ====== To get info about your existing existing targets: ======none $ android list targets Available Android targets: id: 1 or "android-8" Name: Android 2.2 Type: Platform API level: 8 Revision: 3 Skins: WVGA854, WVGA800 (default), QVGA, HVGA, WQVGA432, WQVGA400 ====== ***Prepare for compilation*** We add an folder ''assets/'' and put as folder ''src/'' the folder ''jtcl-2.0.0/src/main/java/tcl/lang'' of Jtcl into our development directory. We have still to put the ''jtcl-2.0.0/src/main/resources/tcl/lang/library/init.tcl'' file into the ''assets/'' folder. JTcl will need it for initialization. Finally your tree hierarchy should look similar to the following: ======none |-- AndroidManifest.xml |-- android | |-- bin | | |-- classes | | |-- classes.dex | | `-- jtcl.ap_ | `-- jtcl.jar |-- assets | `-- init.tcl |-- bin |-- build |-- build.xml |-- development.txt |-- jtcl.properties |-- libs |-- proguard.cfg |-- res | |-- drawable-hdpi | | `-- icon.png | |-- drawable-ldpi | | `-- icon.png | |-- drawable-mdpi | | `-- icon.png | |-- layout | | `-- main.xml | `-- values | `-- strings.xml `-- src `-- tcl `-- lang ====== ***Create the binary*** The file ''jtcl.properties'' will define our local Android environment: ======none $ cat jtcl.properties sdk-folder=~/Projekte/jtcl android-tools=~/Programme/android-sdk-linux_x86/tools android-platform=~/Programme/android-sdk-linux_x86/platforms/android-8 android-platform-tools=~/Programme/android-sdk-linux_x86/platform-tools ====== The file `Interpr.java` in `src/tcl/lang/` has to be modified to load the `init.tcl` from our `assets/` directory: ====== // evalResource("/tcl/lang/library/init.tcl"); evalResource("assets/init.tcl"); ====== Then all is ready for ant which will be fed by the following `build.xml`: ====== Creating output directories if needed... bootclasspath: ${android-jar} Building android/jtlc.jar from dir: ${android.build} ... Converting compiled files and external libraries into ${outdir}/${dex-file}... Packaging resources and assets... Deleting dir: ${android.build} ====== ***Preparing test*** In the directory `/android/bin` we will find now the executable file `classes.dex` and a file `jtcl.ap_` with the resources compiled in, so we still have to add the executable to our `jtcl.ap_`: ======none aapt add jtcl.ap_ classes.dex ====== The above mentioned ''assets/init.tcl'' still has to be modified. For the moment we have no tcllib files in our assets folder so we comment out autoloading of tcllib packages: ====== # set dir resource:/tcl/pkg/tcllib/library # source $dir/pkgIndex.tcl puts "Note: No tcllib package available" ====== Now ''jtcl.ap_'' is ready for a test: We push ''jtcl.ap_'' to Android assumed the folder `/data/local/bin` has been already created by use of `adb shell`: ======none $ adb push jtcl.ap_ /data/local/bin ====== After connection to a running Android device with ''adb shell'' you call JTcl with its entrypoint ''tcl.lang.Shell'': ======none # dalvikvm -Xbootclasspath:/system/framework/core.jar -classpath /data/local/bin/jtcl.ap_ tcl.lang.Shell ====== That's it. Sure, you can use this call inside a "Terminal emulator" Android application. The next steps will be: * Try to get access to the Android GUI widgets by using JTcl's java::* commands * To make a clean Android JTcl.apk which can be launched by click executing during initialization not only init.tcl but application code, e.g. in myscript.tcl <> Application