Difference between revisions of "Java Support in webOS"
m (→The Harmony Files: add Harmony standard jar files removed by Palm in his Harmony package) |
|||
Line 239: | Line 239: | ||
/usr/lib/jvm/java-1.5-palm/jre/lib/security/java.policy | /usr/lib/jvm/java-1.5-palm/jre/lib/security/java.policy | ||
/usr/lib/jvm/java-1.5-palm/jre/lib/security/java.security | /usr/lib/jvm/java-1.5-palm/jre/lib/security/java.security | ||
+ | |||
+ | ==== Harmony standard jar files removed by Palm in his Harmony package ==== | ||
+ | |||
+ | When you check the file http://archive.apache.org/dist/harmony/harmony/harmony/milestones/M4/apache-harmony-jre-r603534-linux-x86-32-snapshot.tar.gz, <BR> | ||
+ | you can see that Palm remove the folowing files in the folder /usr/lib/jvm/java-1.5-palm/jre/lib/boot/ : <BR> | ||
+ | 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, <BR> | ||
+ | rmi.jar, sound.jar, suncompat.jar, swing.jar, vmmagic-20070207.jar. | ||
== Specific Palm Java packages == | == Specific Palm Java packages == |
Revision as of 10:28, 2 June 2010
The JVM
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, OasisVM Build 96.2 with webOS 1.1.0 The web server for iventor.com return only 404 errors. We can see a version of this website at www.iventor.com 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 -Xstackdump=<filename> - -ms enable memory stats -Xxray=fifoname enable xray output -Xwebconsole enable web console at 127.0.0.1:8083
The Java process used by webOS :
root@castle:/etc# ps -ax -o user,cmd | grep java USER CMD ... root@palm-webos-device:/# ps -ax -o user,cmd | grep java root /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/boot/security.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/archive.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/logging.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/text.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/icu4j_3.8/icu4j-3_8.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/icu4j_3.8/icu4j-charsets-3_8.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/ext/icu4jni.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/sql.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/regex.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/math.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/auth.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/crypto.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/x-net.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/boot/annotation.jar :/usr/lib/jvm/java-1.5-palm/jre/lib/ext/bcprov.jar -Djava.home=/usr/lib/jvm/java-1.5-palm/jre -Djava.security.properties=/usr/lib/jvm/java-1.5-palm/jre/lib/security/java.security -Xstackdump=/var/log/stackdump.txt -Xms10M -Xmx15M -classpath /usr/lib/luna/java/Async.jar :/usr/lib/luna/java/CarrierNetworkSettings.jar :/usr/lib/luna/java/Customization.jar :/usr/lib/luna/java/DefaultDatabaseBuilder.jar :/usr/lib/luna/java/Fnmbl-ClientApi.jar :/usr/lib/luna/java/Fnmbl-ClientFramework.jar :/usr/lib/luna/java /InterfaceRegistry.jar :/usr/lib/luna/java/MediaEvents.jar :/usr/lib/luna/java/Photos.jar :/usr/lib/luna/java/Utils.jar :/usr/lib/luna/java/accounts.jar :/usr/lib/luna/java/accountservices.jar :/usr/lib/luna/java/activerecord.jar :/usr/lib/luna/java/backup.jar :/usr/lib/luna/java/calendar.jar :/usr/lib/luna/java/contacts.jar :/usr/lib/luna/java/dataimport.jar :/usr/lib/luna/java/datamigration.jar :/usr/lib/luna/java/deviceprofile.jar :/usr/lib/luna/java/devicewipe.jar :/usr/lib/luna/java/facebook.jar :/usr/lib/luna/java/findapps.jar :/usr/lib/luna/java/gdata.jar :/usr/lib/luna/java/jWAP.jar :/usr/lib/luna/java/java-md5.jar :/usr/lib/luna/java/joda-time-1.5.2.jar :/usr/lib/luna/java/json.jar :/usr/lib/luna/java/ksoap2-j2se-full-2.1.1.jar :/usr/lib/luna/java/libmatthew-java-0.7.jar :/usr/lib/luna/java/location.jar :/usr/lib/luna/java/lunaservice.jar :/usr/lib/luna/java/mail.jar :/usr/lib/luna/java/messaging.jar :/usr/lib/luna/java/messagingrouter.jar :/usr/lib/luna/java/minidbus-java-2.4.jar :/usr/lib/luna/java/notes.jar :/usr/lib/luna/java/packageinfo.jar :/usr/lib/luna/java/palmipc.jar :/usr/lib/luna/java/pim.jar :/usr/lib/luna/java/pimsync.jar :/usr/lib/luna/java/rfc2445.jar :/usr/lib/luna/java/scheduler.jar :/usr/lib/luna/java/serviceboot.jar :/usr/lib/luna/java/serviceframework.jar :/usr/lib/luna/java/sqlitejdbc-v053.jar :/usr/lib/luna/java/superlog.jar :/usr/lib/luna/java/tasks.jar :/usr/lib/luna/java/telephony.jar :/usr/lib/luna/java/zone-info.jar -DtimeZoneId=CET -Djava.util.logging.config.file=/etc/logging.properties -verbose:gc -Xwebconsole -Xoomexit -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: /usr/bin/javahy /usr/bin/jps /usr/bin/jthreads /usr/bin/jtop /usr/lib/jvm/java-1.5-palm/bin/.debug/libvmi.so /usr/lib/jvm/java-1.5-palm/bin/java /usr/lib/jvm/java-1.5-palm/bin/libvmi.so
The Harmony Kernel
root@qemux86:/# ipkg files harmonykernel Package harmonykernel (1.0.0-21) is installed on root and has the following files: /usr/lib/jvm/java-1.5-palm/lib/rt.jar
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/harmony.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_ca.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_cs.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_de.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_es.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_fr.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_hu.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_it.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_ja.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_ko.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_pl.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_pt_BR.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_ru.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_sk.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_sl.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_tr.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_zh.properties /usr/lib/jvm/java-1.5-palm/jre/bin/harmony_zh_TW.properties /usr/lib/jvm/java-1.5-palm/jre/bin/libICUInterface34.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhyarchive.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhyauth.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhycharset.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhyluni.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhynio.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhyprt.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhythr.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhyxnet.so /usr/lib/jvm/java-1.5-palm/jre/bin/libhyzlib.so /usr/lib/jvm/java-1.5-palm/jre/lib/boot/annotation.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/archive.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/auth.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/crypto.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/logging.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/luni.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/math.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/boot/regex.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/security.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/sql.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/text.jar /usr/lib/jvm/java-1.5-palm/jre/lib/boot/x-net.jar /usr/lib/jvm/java-1.5-palm/jre/lib/content-types.properties /usr/lib/jvm/java-1.5-palm/jre/lib/logging.properties /usr/lib/jvm/java-1.5-palm/jre/lib/net.properties /usr/lib/jvm/java-1.5-palm/jre/lib/rowset.properties /usr/lib/jvm/java-1.5-palm/jre/lib/security/java.policy /usr/lib/jvm/java-1.5-palm/jre/lib/security/java.security
Harmony standard jar files removed by Palm in his Harmony package
When you check the file http://archive.apache.org/dist/harmony/harmony/harmony/milestones/M4/apache-harmony-jre-r603534-linux-x86-32-snapshot.tar.gz,
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 - java-com.palm.photos - 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 -
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 HelloWorld.java.
3) Add the following lines in the file HelloWorld.java :
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } }
4) Compile the sources with the command line :
javac HelloWorld.java
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 :
novaterm
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 /boot/security.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/archive.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/logging.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/text.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/icu4j_3.8/icu4j-3_8.jar: /usr/lib/jvm/java-1.5-palm/jre/lib/boot/icu4j_3.8/icu4j-charsets-3_8.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/ext/icu4jni.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/sql.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/regex.jar:/usr/lib/jvm/java- 1.5-palm/jre/lib/boot/math.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/auth.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/crypto.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/x-net.jar:/usr/lib/jvm/java-1.5-palm/jre/lib/boot/annotation.jar: /usr/lib/jvm/java-1.5-palm/jre/lib/ext/bcprov.jar -Djava.home=/usr/lib/jvm/java-1.5-palm/jre -Djava.security.properties=/usr/lib/jvm/java-1.5-palm/jre/lib/security/java.security -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(HelloWorld2.java:3)
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.