Java Support in webOS

From WebOS Internals
Jump to navigation Jump to search


Note: In first semester 2010, Palm has announced that in a future version of webOS, the JVM will no longer be included (more information here. And since webOS 2.1.0, Java support in webOS was removed and the projects which depend on the OasisVM JVM "suddenly fail" after this update.

Now you can backport Palm Java JVM OasisVM (JRE) on webOS 2.0 and above devices :


There is a JVM in webOS. His name is OasisVM.

You can have more information when you use this command-line :

root@palm-webos-device:/# javahy --help
OasisVM: Build 107
Copyright 2005, Iventor, Inc. All Rights Reserved
Build options are: Oasis-Linux-WebConsole-LightLocks-Generational-GCC_Goto_Optimizations-SingleSlot
usage: OasisVM [options] [classfile [args]]

Note: OasisVM Build 107 with webos 1.4.1 and 1.4.5, OasisVM Build 96.2 with webOS 1.1.0 The web server for return only 404 errors. We can see a version of this website at from a couple of years ago. This company was founded by Paul Mercer.

Options in OasisVM Build 107 are :

Options are:
-classpath <path> or -cp <path>
-bootclasspath <path> or -bcp <path>
-h, --help                    Display help and exit
-m, --object-heap-size <num>  Set object heap size
-s, --vm-stack-size <num>     Set java stack size
-t, --nm-stack-size <num>     Set native methods stack size
-Xstacklimit=<num>                     Set java stack limit
-d, run the VM as a daemon
-Xms set object heap size (variant)
-Xmx set object heap size (variant)
-Xnh set native code heap size
-Xint interpreter only (disable the JIT)
-Xpreload=<filename> file containing list of classes to preload before running main
-Xpreloadout=<filename> output file containing list of classes we loaded
-verbose:[class|threads|gc|warnings] print extra debugging info
-Xprofile print periodic profiler stats
-Xgcnocopy use a non-copying garbage collection
-Xconservative use conservative collection
-Xexact use exact collection
-Xtraceall trace all classes (no class unloading)
-Xgcagressive agressive garbage collection
-Xgcdelay      wait X ms before garbage collection begins
-Xnoyank       disable rug yanking
-Xnossa        disable SSA optimizations
-XnoSSA        disable SSA optimizations
-nojit synonym for -Xint
-Xrandcomp     random JIT compiles
-Xbreak        debug break after initializing the VM
-Xbootbreak    debug break before initializing the VM
-XX:+HeapDumpOnOutOfMemoryError        dump heap to oom.hprof on OOM error
-ms                    enable memory stats
-Xxray=fifoname        enable xray output
-Xwebconsole   enable web console at

The Java process used by webOS :

root@castle:/etc# ps -ax -o user,cmd | grep java 
root@palm-webos-device:/# ps -ax -o user,cmd | grep java
root     /usr/lib/jvm/java-1.5-palm/bin/java 
-m 10M 
/usr/lib /jvm/java-1.5-palm/lib/rt.jar
-classpath /usr/lib/luna/java/Async.jar
:/usr/lib/luna/java /InterfaceRegistry.jar
-Xoomreport=/var/javaoom/oom.1149.txt com.palm.serviceboot.ServiceBoot start

The Java Classes

The OasisVM JVM in webos use Java Classes from Harmony to Implement the Java Platform Standard Edition 5.

In webOS 1.4.1 for Harmony and OasisVM versions, we have :
root@palm-webos-device:/# ipkg list | grep harmony
harmony - 5.0.r603534-67 -
harmonykernel - 1.0.0-21 -
oasisharmonyvm - 1.0-107 -

Note : revision 603534 was commit in the Harmony SVN the 12th December 2007 and Harmony 5.0 M4 stable was release the 2007-12-19 (History relases here).

The revision 603534 for Harmony is old, more than 2 years, and there was improvements in Harmony :

  • 5.0 M6 with new JIT optimizations, improved VM threading design
  • 5.0 M9 with performance: across multiple areas, including class library improvements and JIT compiler global propagation optimizations, integer MUL/DIV/REM strength reduction,

JVM and Harmony packages

The JVM Files

root@qemux86:/# ipkg files oasisharmonyvm
Package oasisharmonyvm (1.0-107) is installed on root and has the following files:

The Harmony Kernel

root@qemux86:/# ipkg files harmonykernel 
Package harmonykernel (1.0.0-21) is installed on root and has the following files:

The Harmony Files

root@qemux86:/# ipkg files harmony      
Package harmony (5.0.r603534-67) is installed on root and has the following files:
/usr/lib/jvm/java-1.5-palm/jre/bin/ (only in X86 webos 1.4.5 emulator)                          
/usr/lib/jvm/java-1.5-palm/jre/bin/   (only in Arm webOS 1.4.5 for devices) Lib ICU4C 3.4.1                              
/usr/lib/jvm/java-1.5-palm/jre/lib/boot/icu4j_3.8/icu4j-3_8.jar (only in Arm webOS 1.4.5 for devices) ICU4J 3.8.0                               
/usr/lib/jvm/java-1.5-palm/jre/lib/boot/icu4j_3.8/icu4j-charsets-3_8.jar (only in Arm webOS 1.4.5 for devices) ICU4J 3.8.0                                                                
/usr/lib/jvm/java-1.5-palm/jre/lib/ext/bcprov.jar   (only in Arm webOS 1.4.5 for devices)                                
/usr/lib/jvm/java-1.5-palm/jre/lib/ext/icu4jni.jar     (only in Arm webOS 1.4.5 for devices)                                                         

Harmony standard jar files removed by Palm in his Harmony package

When you check the file,
you can see that Palm remove the folowing files in the folder /usr/lib/jvm/java-1.5-palm/jre/lib/boot/ :
accessibility.jar, antlr-2.7.5.jar, applet.jar, awt.jar, bean.jar, concurrent.jar, image-io.jar, instrument.jar, jndi.jar, lang-management.jar, luni-kernel-stubs.jar, misc.jar, pack200.jar, prefs.jar, print.jar,
rmi.jar, sound.jar, suncompat.jar, swing.jar, vmmagic-20070207.jar.

Specific Palm Java packages

root@qemux86:/# ipkg list | grep java
gdata-java-client - 1.0-7 -          
java-activerecord - 1.0-100 -        
java-async - 1.0-6.1 -               
java-com.palm.accounts - 1.0-105 -   
java-com.palm.accountservices - 1.0-100 - 
java-com.palm.backup - 1.0-92 -           
java-com.palm.calendar - 1.0-117 -        
java-com.palm.carriernetworksettings - 1.0-88.4 - 
java-com.palm.contacts - 1.0-123 -                
java-com.palm.customization - 1.0-39 -            
java-com.palm.dataimport - 1.0-25 -               
java-com.palm.datamigration - 1.0-16 -            
java-com.palm.defaultdatabasebuilder - 1.0-7 -    
java-com.palm.deviceprofile - 1.0-43 -            
java-com.palm.devicewipe - 1.0-8 -                
java-com.palm.facebook - 1.0-18 -                 
java-com.palm.findapps - 1.0-1.1 -                
java-com.palm.interfaceregistry - 1.0-3.1 -       
java-com.palm.location - 1.0-67 -                 
java-com.palm.mail - 1.0-339 -                    
java-com.palm.mediaevents - 1.0-12 -              
java-com.palm.messaging - 1.0-229 -               
java-com.palm.messagingrouter - 1.0-46 -          
java-com.palm.notes - 1.0-3 -                     
java-com.palm.packageinfo - 1.0-9.1 -     - 1.0-6 -                    
java-com.palm.pim - 1.0-198 -                     
java-com.palm.pimsync - 1.0-142 -                 
java-com.palm.scheduler - 1.0-38 -                
java-com.palm.serviceboot - 1.0-42 -              
java-com.palm.superlog - 1.0-19.1 -               
java-com.palm.tasks - 1.0-28 -                    
java-com.palm.telephony - 1.0-192.1 -             
java-md5 - 1.0-3 -                                
java-service - 1.0-58 -                           
java-utils - 1.0-64 -                             
java-zone-info - 1.0-2 -                          
libmatthew-java - 0.7-r2 -                        
palmipc-java - 1.0.0-21 -

detailed files in each palm specific package

root@qemux86:/# ipkg files java-async
Package java-async (1.0-6.1) is installed on root and has the following files:
root@qemux86:/# ipkg files java-activerecord
Package java-activerecord (1.0-100) is installed on root and has the following files:
root@qemux86:/# ipkg files gdata-java-client
Package gdata-java-client (1.0-7) is installed on root and has the following files:
root@qemux86:/# ipkg files java-md5         
Package java-md5 (1.0-3) is installed on root and has the following files:
root@qemux86:/# ipkg files java-service
Package java-service (1.0-58) is installed on root and has the following files:
root@qemux86:/# ipkg files java-utils  
Package java-utils (1.0-64) is installed on root and has the following files:
root@qemux86:/# ipkg files java-zone-info
Package java-zone-info (1.0-2) is installed on root and has the following files:

Matthew Johnson's Java Libraries : Unix Sockets Library, Debug Library, CGI Library, I/O Library

root@qemux86:/# ipkg files libmatthew-java
Package libmatthew-java (0.7-r2) is installed on root and has the following files:
root@qemux86:/# ipkg files palmipc-java   
Package palmipc-java (1.0.0-21) is installed on root and has the following files:

Compile and Test the Hello World program on Palm webOS

1) You need a Java compiler on your computer (Linux, Windows, MacOS X).
2) Create a file
3) Add the following lines in the file :

public class HelloWorld { 
  public static void main(String[] args) { 
     System.out.println("Hello, World");

4) Compile the sources with the command line :


5) Copy the HelloWorld.class on the Palm emulator by

scp -P 5522 HelloWorld.class root@localhost:/media/internal

or by copying the file on the root of the partition disk when your Palm device is connected as USB device.
6) Launch novacom proces if it is not launched.
7) Launch novaterm terminal :


8) Go in the /media/internal folder

root@qemux86# cd /media/internal

10) Execute your java program :

root@qemux86:/media/internal# javahy HelloWorld
Command line arguments:  /usr/lib/jvm/java-1.5-palm/bin/java -Xexact -m 10M -Djava.library.path=/usr/lib/jvm/java-1.5-palm/bin:/usr/lib/jvm/java-1.5-palm/jre/bin:/usr/lib -Dvm.boot.library.path=/usr/lib/jvm/java-1.5-palm/jre/bin 
-bootclasspath /usr/lib/jvm/java-1.5-palm/lib/rt.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/luni.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/nio.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/nio_char.jar:/usr/lib/jvm/java-1.5-palm/jre/lib
/usr/lib/jvm/java-1.5-palm/jre/lib/ext/bcprov.jar -Djava.home=/usr/lib/jvm/java-1.5-palm/jre -Xstackdump=/var/log/stackdump.txt HelloWorld
@@@@ ClassLibrary initialize begins...
Harmony interface GetInitArgs() not implemented
@@@@ ClassLibrary initialized... elapsed=147 ms
Hello, World

Note : use javahy -strace YourJavaClasse to debug your program

No AWT or Swing support for Java applications with a Graphic User Interface in webOS

As you can see above, you can use java program in console text mode in Palm webOS. But if you try to use the HelloWorld program with the Swing Graphic User Interface, you have this error :

root@qemux86:/media/internal# javahy HelloWorld2
@@@@ ClassLibrary initialized... elapsed=96 ms
java.lang.ClassNotFoundException: javax/swing/JOptionPane
       at HelloWorld2.main(

You have this error because all the standard Java Classes in Harmony are not all available in the Palm WebOS package harmony - 5.0.r603534.
The files awt.jar and swing.jar are not in the folder /usr/lib/jvm/java-1.5-palm/jre/lib/boot as you can see in Harmony files list.

The OasisVM JVM in webOS used only for for back-end services ?

Several users report that the JVM in Palm webOS is only used for back-end services/system services in theses posts : Post1, Post2.

Upgrading Java support on webOS devices

Firt choice

Keeping OasisVM JVM and upgrading Harmony Java classes that support JSE 1.5. The problem is that Harmony is now a death project with no updates since 2010-09-15 and Apache Harmony is retired at the Apache Software Foundation since Nov 16, 2011.
Then need to install a cross compiling environment or PDK for ARM chips on your computer.

then compile Harmony Java classes by using steps here :
and here :
Harmony with Linux/ARM port?

Secondth choice

Replacing OasisVM JVM by an other JVM (JamVM is the best choice among the others JVM.With Dacapo tests, it have good results as as you can see at the end of this page. JamVM use a little memory and the next release is optimised for ARMv7a architecture as chips in Palm- and + and 2. You can use JamVM with Eclipse, Jedit, derby as the JamVM's developer said in his blog here.You can use Gnu classpath or OpenJDK , suppoerted by JamVM, for replacing Harmony Java classes as Java classes with JSE 1.6 support, but because there is no updates for GNU Classpath since 5 February 2009, the best choice here is now to use OpenJDK classes.(Open)JDK6 for embedded ARM.

See Also