Guides/JQt for Android

From J Wiki
Jump to navigation Jump to search

Other Android Ports

There is another Android port of J, Jconsole for Android by Michael Dykman. It also provides a fine soft keyboard tailored for J.

Minimum Requirement

Android 2.3.3 ARMv5 - for older devices

Android 4.0 ARMv7 - for devics with ARMv7 CPU

Android 4.0 x86 - for devics with Atom CPU

Install and Upgrade

Before installation, enable Unknown Sources if not yet done. To access the Unknown Sources setting directly, press the menu icon or button from the Home screen and tap Settings. Select Security (Android OS 4.0+) or Applications (Android OS 3.0 and earlier). You may need to scroll down to see the Unknown Sources setting.

Open a web browser to download and install qtide-armeabi-v7a.apk on your Android device. A green J icon labeled jqt will appear in launcher screen if installed successfully. The first run will show a blank screen for 1 to 2 minutes because it takes time to decompress files. After the IDE shows up, tap on Back Button 3 times to finish install.

JQt for Android is bundled with Qt runtime files so that it may consume 40 to 50 MB of RAM storage. Choose external install (move to sdcard) if necessary, then it will take about 12 MB of RAM storage.

Do not run install 'qtide' to install or upgrade. It won't work.

JQT Keyboard

This is the JKeyboard from Michael Dykman, renamed to "JQT Keyboard" to avoid name conflict. Go to Settings >> Language & Input to activate JQT Keyboard. We do not collect your data. Finally scroll up and select JQT Keyboard in the default box.


There are some android specific configuration options in qtide.cfg

  • FontFile= colon (:) delimited font file names to be loaded during startup. Files are assumed to be inside the ~config folder.

Back Button

Term Window

Tapping Back Button 3 times will close a J session.

Editor Window

Tapping Back Button will switch to Term window.

Other QTIDE Window

Tapping Back Button will close the current window.

WD Form


Windows (forms) that are created with an "owner" attribute.

Tapping Back Button will close the current window.

Non Modal

Tapping Back Button once will display another window created by wd command in a cyclic manner.

Tapping Back Button twice will close the current window.

Optional Utilities

External Editor

As present, the session term and editor implemented using QPlainTextEdit do not behave well under touch screen. A temporary workaround is to use an external editor.

Visit Google Play and search for text editor or code editor, install some of them if you are not sure which one is the best for you.

In Qt IDE editor view, tap on the edit icon with pop up choices of available editors, edit the file using one of them and then save the file and return to Qt IDE using Back Button. Press the reload icon to pick the changes made.


$EXTERNAL_STORAGE is the path of the sdcard folder which is usually /mnt/sdcard,

~install  $EXTERNAL_STORAGE/Android/data/
~bin      /data/data/
~system   ~install/system
~addons   ~install/addons
~user     $EXTERNAL_STORAGE/j804-user

other folders will be under ~user


~break is empty and will not be used.

Upon uninstall, all files under ~install will be removed by Android.

File permission

Files on sdcard (except some special folders) are public and can be read and written by all users/apps.

Files under /data/data/{android apps} are owned by the respective apps, and not accessible by other Android apps such as text editor, image viewer.

Location of Shared Libraries

Startup Files

~install/bin/profilex.ijs         NB. if present
~home/.jprofile.ijs               NB. if present
~install/bin/startup_android.ijs  NB. if present

profilex.ijs is typically used for setting up system folders. Other customization can be put in either .jprofile.ijs or welcome.ijs.


Command line frontend jconsole executable is also available with full path name

jpath '~bin/jconsole'

Its file permission is 755. There is no visible icon for jconsole on Android screen.

It can be called from J using 2!:0 or 2!:1 in a non-interactive mode.

Certain Android Apps such as Shell and Terminal Emulator can run jconsole in an interactive mode.

Force Update

The Android APK file contains system base library and some addons. Whenever Jqt starts, it will check the version number stored in


to determine if it needs to decompress and overwriting files. If you want it to decompress files again, just delete this file and restart J, and then quit again to finish install.

Building Android Apps

A webservice is provided by JSoftware at buildapk for building Android Apps.

Download ,decompress and study the sample project alpha.tgz. You can also test building android apps with the sample project.

The apk built using the sample project is on this page.

├── addons
│   ├── api
│   ├── convert
│   ├── graphics
│   ├── gui
│   └── ide
├── bin
│   ├── installer.txt
│   ├── profile.ijs
│   ├── profilex_template.ijs
│   └── startup_android.ijs       *
├── projects                      *
│   └── alpha
└── system
    ├── config
    ├── defs
    ├── main
    └── util

It is recommended to follow this pattern for organizing files.

bin and system folders are the same as that in desktop J except J executables and shared objects ( need not be included.

copy all required addon folders under addons folder. Notes that some addons may depend on other addons.

the tools folder is usually not required.

Create a temporary folder, eg. INSTALL, but the actual name is not important.

Copy addons, bin, system and your project there.

startup_android.ijs (if present) will be run by the default profile, create this file and use it to load and execute your project file. (see sample project)

Content of the startup_android.ijs in the sample project is:

NB. change ~Projects to a location under ~install
UserFolders_j_=: (<jpath'~install/projects') (<1,~({."1 UserFolders_j_)i.<'Projects')}UserFolders_j_
NB. run project
load '~Projects/alpha/alpha.ijs'

There is only one script alpha.ijs and one image file under the sample ~Projects/alpha folder. The alpha.ijs script is very simple.

require 'gl2'

coclass 'alpha'

PJ=: jpath '~Projects/alpha'

NB. =========================================================
run=: 3 : 0
wd 'pc form;pn alpha'
wd 'cc png isidraw'
wd 'cc track slider 2 0 1 5 255 100'
d=: readimg_jqtide_ PJ,'/lena.png'
wd 'pshow'
NB. workaround isidraw initial display bug
track=: 100
immexj' form_track_changed_alpha_$0'

form_close=: exit bind 0

form_track_changed=: 3 : 0
d2=. (".track) setalpha d
glfill 255 128 255
glpixels 0 0,(|.$d2), ,d2


Change directory to the INSTALL folder and use zip or tar utility to compress the all folders. eg,

Compress using tar

cd /path/to/INSTALL
tar -czf ../alpha.tgz .
cd ..

Compress using zip

cd /path/to/INSTALL
zip -r ../ *
cd ..

Other GUI programs also work so long as the compressed format is either zip, tar or tar.gz (tgz).

Finally use a browser to open the buildapk web page and follow instructions there to upload the compressed file.

The file name of the apk built will be in the form of package-aaaaa-bbbbb.apk where package is the package name, aaaaa is the target architecture and bbbbb is the hexadecimal digits of the first 5 bytes of the SHA1 checksum of the zip/tar file. After downloading, you can rename the apk to package.apk or any other names you like.


  • during testing on desktops, the file startup_android.ijs is not needed and you can put project files anywhere you like.
  • may need to modify UserFolders_j_ or SystemFolders_j_ (see sample project)
  • default profile will not run ~config/startup.ijs in the presence of startup_android.ijs.
  • do not assume files inside the ~user and ~config folders will be read or are effective.
  • the compressed zip/tar file uploaded during building apk will be decompressed under the ~install folder during the first run of the app.
~install  $EXTERNAL_STORAGE/Android/data/[package name]/files

* [package name] is the name of package when building apk using the webservice.
  • ~bin is different from ~install/bin
  • environment variable HOME is usually the root of SDCARD.
  • the size of apk is at least about 14 MB because of the Qt library bundled.
  • choose armv5 architecture if your apps are also targeted for old Android devices such as those running Android 2.x. Armv5 apk can also run on (but not optimized for) Armv7 devices.
  • normally, only the user who uploads and builds an apk will know the download URL of the apk built. Apk's built will be cleaned up periodically.
  • the signing key of the webservice for android apk is kept secret.

Debug Android Apps

It is rather tedious to debug an Android App inside Android devices. Instead it is much easier to verify everything already worked on desktop except Android specific functions.

On Linux or Windows, copy the desktop J bin (including jqt and Qt libraries) to replace the bin under the temporary INSTALL folder, and run jqt from there.

On the Qt IDE term, load the startup_android.ijs.

load '~install/bin/startup_android.ijs'

or type the same commands as that contained in startup_android.ijs

Check for any missing addons or incorrect file locations.

Once an Android app can boot up on Android devices, debug cycle can be shortened by directly editing J scripts inside ~install on Android devices.


  • printing and webkit widget are not yet supported
  • overlapping window will not be supported
  • keyboard shortcut is not supported
  • some addons such as FFTW do not work because of missing shared libraries.

Known issues

  • the version for Android 2.3.3 ARMv5 is not recommended, use a newer Android device if affordable.
  • editor does not support gestures, not suitable for touch screen.
  • the screen of Qt IDE can go blank after a long period of inactivity. Press the virtual F1 button to repaint the screen.
  • quickwidget not yet supported.

See Qt IDE.

Contributed by Bill Lam