Java

(Nokia: fix spelling)
(Solutions: adds compiled summary of http://talk.maemo.org/showthread.php?t=37405 (someone please reread what I wrote))
 
(11 intermediate revisions not shown)
Line 9: Line 9:
==== Nokia ====
==== Nokia ====
-
Nokia does not plan support because Nokia already supports 2 development platforms: either GTK (Maemo 5) or Qt (Maemo 6) as well as WRT (Web Run Time).
+
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).
 +
 
 +
==== N900 Application Manager ====
 +
 
 +
Java now available on the N900 via the [http://maemo.org/packages/view/icedtea6/ icedTea6] version of OpenJDK(tm) in [[extras]]. Check your Application Manager for "icedTea6" to install.
=== Hardware support ===
=== Hardware support ===
==== 770/N800/N810(WME) ====
==== 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 [http://en.wikipedia.org/wiki/Jazelle the Jazelle entry at Wikipedia].
+
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 [[:wikipedia:Jazelle|the Jazelle entry at Wikipedia]].
==== N900 ====
==== N900 ====
Line 35: Line 39:
=== [https://wiki.evolvis.org/jalimo Jalimo] ===
=== [https://wiki.evolvis.org/jalimo Jalimo] ===
Aims for Java SE compliance with pre-SUN_Java_GPLed_code, previously ported to Maemo.
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.
=== Google Android's Virtual Machine Dalvik ===
=== Google Android's Virtual Machine Dalvik ===
Line 52: Line 59:
=== Unsorted ===
=== Unsorted ===
For Java support in Maemo Browser a plugin is required. (References to be written.)
For Java support in Maemo Browser a plugin is required. (References to be written.)
 +
 +
=== Sun Java SE for embedded ===
 +
 +
:''Note: this software is proprietary; the OpenJDK is available, see the Cambridge Software Labs section below''
 +
 +
#Downloaded the Sun Java SE for Embedded (ARMv6 jre 1.6_10 Headful) [https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=ejre-6u10-oth-JPR@CDS-CDS_Developer Download it here]. (XXX old link, double-check)
 +
#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.
 +
#(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...) <s>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.</s>
 +
#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.
 +
#Open a Terminal and type:
 +
#:sudo gainroot
 +
#:mkdir /home/opt/java
 +
#:cd /home/opt/java
 +
#:tar -xzvf /home/user/MyDocs/<filename>.tar.gz
 +
# 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.
 +
# 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).
 +
# Now you will be able to download Java SE jarfiles and run them by typing "java -jar somejarfile.jar"
 +
# 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.
 +
 +
[http://web.archive.org/web/20080308015352/http://java.sun.com/products/java-media/2D/samples/java2demo/Java2D.zip Java2D sample] works with this method.
 +
 +
[http://talk.maemo.org/showpost.php?p=430791&postcount=13 original post]
 +
[http://talk.maemo.org/showpost.php?p=432083&postcount=24 'lesson' 1]
 +
 +
To enable Mozilla browser plugin [http://talk.maemo.org/showthread.php?p=959215#post959215]:
 +
#Extract ejre1.6.0_21 from the archive to MyDocs in N900
 +
#Move ejre1.6.0_21 to /opt (I was using MC)
 +
#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
 +
#Then in microB and Firefox type about:config in address
 +
#Search for java
 +
#Change java.java_plugin_library_name to libnpjp2.so
 +
#I don’t know if changing in about:config is needed because I did this at the beginning.
 +
#After that chromium was running java without any changes.
 +
 +
=== MicroEmulator ===
 +
{{main|Microemulator}}
 +
There is also some [http://talk.maemo.org/showthread.php?p=238027#post238027 micro emulator] thing which may be Java related. [http://talk.maemo.org/showpost.php?p=435335&postcount=53 more of the same] ([http://talk.maemo.org/showpost.php?p=435479&postcount=55 mirror])
 +
 +
To run a midlet [http://talk.maemo.org/showpost.php?p=494025&postcount=118]:
 +
# Install JRE
 +
# Go to http://www.microemu.org/ and download the zip file
 +
# Unzip the file
 +
# Go to folder in terminal and run java -jar microemulator.jar
 +
# Get out your stylus and used the menu to open dbmidlet.jar
 +
 +
[http://www.microemu.org/maemo this one manual] outdated doesn't work at all. [http://talk.maemo.org/showpost.php?p=511778&postcount=148]
 +
 +
no gps? [http://talk.maemo.org/showpost.php?p=518089&postcount=161][http://talk.maemo.org/showpost.php?p=518240&postcount=165] [http://talk.maemo.org/showpost.php?p=657320&postcount=240 work in progress]
 +
 +
[http://talk.maemo.org/showpost.php?p=542689&postcount=193]
 +
[http://talk.maemo.org/showpost.php?p=542689&postcount=194], confirming the steps above
 +
 +
I'd like to be able to use it in portrait mode, and ofcourse keyboard support would be nice [http://talk.maemo.org/showpost.php?p=837802&postcount=269]
 +
 +
=== Cambridge Software Labs OpenJDK for ARM ===
 +
 +
{{main|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 [http://www.camswl.com/openjdk/])
 +
 +
[http://talk.maemo.org/showpost.php?p=496437&postcount=122 "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"). [http://talk.maemo.org/showpost.php?p=508945&postcount=138]
 +
 +
===porting pspkvm to N900?===
 +
 +
how about porting pspkvm to N900? pspkvm is a JavaME emulator for the PSP. Link: [http://sourceforge.net/apps/trac/pspkvm]
 +
 +
pspkvm is itself a port of the [https://phoneme.dev.java.net/ PhoneME] software. Porting directly from PhoneME to Maemo is probably a better bet, rather than going from pspkvm.
 +
 +
[http://talk.maemo.org/showpost.php?p=460238&postcount=86] [http://talk.maemo.org/showpost.php?p=459131&postcount=82]
== Brainstorm ==
== Brainstorm ==
Line 58: Line 146:
[[Category:Development]]
[[Category:Development]]
[[Category:N900]]
[[Category:N900]]
 +
 +
== Tutorials ==
 +
* [http://www.leolol.com/drupal/tutorials/java/lessons Java Programming Lessons]
 +
* [http://www.leolol.com/drupal/tutorials/java/exercises Java Programming Exercises] with sample solutions

Latest revision as of 00:02, 12 August 2015

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://wiki.maemo.org/Java"