Java

This page is about the Java programming language and Java Virtual Machine.

Contents

[edit] Current state of affairs

[edit] Official support

[edit] SUN

There is no official Java ME or Java SE from SUN as of yet.

[edit] Nokia

Nokia does not plan support because Nokia already supports 2 development platforms with Maemo: either GTK (Maemo 5) or Qt (Maemo 6) as well as WRT (Web Run Time).

[edit] N900 Application Manager

Java now available on the N900 via the icedTea6 version of OpenJDK(tm) in extras. Check your Application Manager for "icedTea6" to install.

[edit] Hardware support

[edit] 770/N800/N810(WME)

The Nokia 770, N800, N810(WME) CPUs have a proprietary extension called Jazelle which accelerates Java execution however this is technology requires a license. Nokia has not opted for such license hence there is no driver for this. For more information about Jazelle please see the Jazelle entry at Wikipedia.

[edit] N900

Nokia N900 contains succesor of Jazelle found on ARMv7, called ThumbEE. This is more general JIT; not JVM-specific. Hardware support (driver) of ThumbEE is unknown.

[edit] Solutions

[edit] Java SE for embedded 6

  • ARMv6 Linux - Headless (Early Access) EABI, glibc 2.5, Soft Float, Little Endian
  • ARMv6 Linux - Headless (Early Access) EABI, glibc 2.5, Hard Float (VFP), Little Endian
  • ARMv6 Linux - Headful (Early Access), EABI, glibc 2.5, Hard Float (VFP), Little Endian
  • ARMv5 Linux - Headless (Early Access), EABI, glibc 2.5, Soft Float, Little Endian
  • ARMv5 Linux - Headful (Early Access), EABI, glibc 2.5, Soft Float, Little Endian)

[edit] OpenJDK 6 JRE

Is ported to Debian GNU/Linux ARMEL therefore should work.

The Cambridge ARM-optimised OpenJDK has been shown to work.

[edit] Jalimo

Aims for Java SE compliance with pre-SUN_Java_GPLed_code, previously ported to Maemo.

Jalimo maemo 4 repo is giving a permission denied error and appear to be down. Development appears to have moved on to openembedded, mailing list still active.

[edit] Google Android's Virtual Machine Dalvik

Maemo could greatly profit if it could run all Android apps. If Maemo subsumes Android, there is no reason anymore to choose Android. Moreover there is already an Ubuntu project aiming at running Android apps in Ubuntu. The main developer does, however, not respond to emails.

[edit] MicroEmu

Java ME emulator written in Java SE previously ported to Maemo

[edit] phoneME

Java ME emulator written in C previously ported to Maemo.

[edit] Qt Jambi

Provides Java bindings for Qt. Swing native supported by headful Java versions.

[edit] Unsorted

For Java support in Maemo Browser a plugin is required. (References to be written.)

[edit] Sun Java SE for embedded

Note: this software is proprietary; the OpenJDK is available, see the Cambridge Software Labs section below
  1. Downloaded the Sun Java SE for Embedded (ARMv6 jre 1.6_10 Headful) Download it here. (XXX old link, double-check)
  2. The downloaded file is a gzipped tar (.tar.gz) archive. It's just a different kinda zipfile...it uses a different process for storing and compressing data, but conceptually they're similar.
  3. (Do not extract the archive on your PC! You can only copy it to vfat and the executable flags are lost - MyDocs is a vfat partition and doesn't support executable flags...) If you don't have a program on N900 to open these yet, download it onto my PC. Fedora GNU/Linux automatically fires up an archive manager when you dbl-click the file. There are free Windows utilities to handle these files too (e.g. 7-zip). When you expand (extract, inflate...whatever) this file, it will create a folder called "ejre1.6.0_10" and neatly store all the java software within.
  4. Copy it to your device,
    • If you have SSH configured and networking working (computer and device in the same wireless or USB network), to recursively copy the folder and all its contents to your N900, all you need to do is use the "scp" command (Secure CoPy via SSH) with the "-r" option. You'll need your N900s IP address - there's a very handy little widget for that (thanks to whoever made it!) example: scp -r ejre1.6.0_10 root@my.n900.ip.addr:/home/opt/java
      • If both your N900 is connected to your home wifi connection, you should be able to replace the IP address with the host name without modifying any files on your system. You can, instead of an IP address, use your N900's host name. From xterm on your N900: "hostname" By default, this returns "Nokia-N900-42-11" Your scp command on your host computer (need winbind installed on it for this to work) then becomes: "scp -r ejre1.6.0_10 root@Nokia-N900-42-11/home/opt/java" Names are easier to memorize than numbers (assuming you aren't being lazy and using the history)
        • Or, if not on WiFi, you will need to enter your N900 hostname into your "/etc/hosts" file for your method to work. Your PC will not know WTF "Nokia-N900-42-11" means, otherwise.
    • Or connect via USB and choose mass storage mode, copy the file over, then disconnect.
  5. Open a Terminal and type:
    sudo gainroot
    mkdir /home/opt/java
    cd /home/opt/java
    tar -xzvf /home/user/MyDocs/<filename>.tar.gz
  6. Next, you'll need to install a link to the main java program, so that when you open an xterm and type "java" it knows what you're talking about. If you've followed my choice of folder location, the java program is located in /home/opt/java/ejre1.6.0_10/bin/java. Open an xterm and use "sudo gainroot" again. Then type "ln -s /home/opt/java/ejre1.6.0_10/bin/java /usr/local/bin/java". This will create a "symlink" (a Symbolic Link....basically a pointer to a file or folder) in /usr/local/bin. You could create it in /usr/bin, but I prefer to keep things separate.
  7. You will also need to alter your /etc/profile file slightly. Open it up (with vi), i.e. "vi /etc/profile", and look at the line beginning with "export PATH=", you need to add ":/usr/local/bin" to the end of the path (inside the quotes).
  8. Now you will be able to download Java SE jarfiles and run them by typing "java -jar somejarfile.jar"
  9. I'm working on registering the ".jar" extension so that you can just dbl-click them to run them....I thought I had it figured out, but it's not working yet.

Java2D sample works with this method.

original post 'lesson' 1

To enable Mozilla browser plugin [1]:

  1. Extract ejre1.6.0_21 from the archive to MyDocs in N900
  2. Move ejre1.6.0_21 to /opt (I was using MC)
  3. Run in terminal as root:
    ln -s /opt/ejre1.6.0_21/bin/* /usr/bin/
    chmod 777 /usr/bin/java
    ln –s /opt/ejre1.6.0_21/lib/arm/libnpjp2.so /usr/lib/browser/plugins/libnpjp2.so
    ln –s /opt/ejre1.6.0_21/lib/arm/libnpjp2.so /home/user/.mozilla/plugins/libnpjp2.so
  4. Then in microB and Firefox type about:config in address
  5. Search for java
  6. Change java.java_plugin_library_name to libnpjp2.so
  7. I don’t know if changing in about:config is needed because I did this at the beginning.
  8. After that chromium was running java without any changes.

[edit] MicroEmulator

Main article: Microemulator

There is also some micro emulator thing which may be Java related. more of the same (mirror)

To run a midlet [2]:

  1. Install JRE
  2. Go to http://www.microemu.org/ and download the zip file
  3. Unzip the file
  4. Go to folder in terminal and run java -jar microemulator.jar
  5. Get out your stylus and used the menu to open dbmidlet.jar

this one manual outdated doesn't work at all. [3]

no gps? [4][5] work in progress

[6] [7], confirming the steps above

I'd like to be able to use it in portrait mode, and ofcourse keyboard support would be nice [8]

[edit] Cambridge Software Labs OpenJDK for ARM

Main article: OpenJDK 6.0 0 (Cambridge Software Labs) on N900


This is a good free/open-source solution,

The optimized OpenJDK for ARM on the N900 provided by Cambridge Software Labs (see [9])

"works quite well for me"

It is without JIT. But they also say that this version gives reasonable performance even without JIT (they say something about "70-80% of the performance of a JIT"). [10]

[edit] porting pspkvm to N900?

how about porting pspkvm to N900? pspkvm is a JavaME emulator for the PSP. Link: [11]

pspkvm is itself a port of the PhoneME software. Porting directly from PhoneME to Maemo is probably a better bet, rather than going from pspkvm.

[12] [13]

[edit] Brainstorm

Please see Task:Brainstorm_Java for an effort to outline possible solutions to improve Java support on Nokia N900.

[edit] Tutorials

Retrieved from "http://bugs.maemo.org/Java"