Zaurus Java FAQ
From OESF
Line 94: |
Line 94: | ||
==Miscellaneous== | ==Miscellaneous== | ||
===What Classes can I use?=== | ===What Classes can I use?=== | ||
| - | * Jeode supports the [http://java.sun.com/products/personaljava/ PersonalJava 1.2 Specification]. As this specification is compatible with jdk1.1.8, you can make/port your program using the jdk1.1 classes. | + | * Jeode supports the [http://java.sun.com/products/personaljava/ PersonalJava 1.2 Specification]. As this specification is compatible with jdk1.1.8, you can make/port your program using the jdk1.1 classes. |
| + | ''(It is apparently still possible to use JNI, obviously, use at your own discretion)'' | ||
'''NOTE''': This excludes all the J2SE Classes (Swing, JMF, JAI, etc) | '''NOTE''': This excludes all the J2SE Classes (Swing, JMF, JAI, etc) | ||
Line 103: |
Line 104: | ||
<table border=0 align=center> | <table border=0 align=center> | ||
<tr><td></td><td>GIF</td><td>JPG</td><td>PNG</td></tr> | <tr><td></td><td>GIF</td><td>JPG</td><td>PNG</td></tr> | ||
| - | <tr><td>Paletted</td><td align=center>http://www.oesf.org/faq/images/javafaq/ticked.gif </td><td align=center>http://www.oesf.org/faq/images/javafaq/unticked.gif </td><td align=center>/images/javafaq/unticked.gif </td></tr> | + | <tr><td>Paletted</td><td align=center>[[Image:Ticked.gif]]http://www.oesf.org/faq/images/javafaq/ticked.gif </td><td align=center>http://www.oesf.org/faq/images/javafaq/unticked.gif </td><td align=center>/images/javafaq/unticked.gif </td></tr> |
<tr><td>TrueColour</td><td align=center>http://www.oesf.org/faq/images/javafaq/unticked.gif </td><td align=center>http://www.oesf.org/faq/images/javafaq/ticked.gif </td><td align=center>/images/javafaq/ticked.gif </td></tr> | <tr><td>TrueColour</td><td align=center>http://www.oesf.org/faq/images/javafaq/unticked.gif </td><td align=center>http://www.oesf.org/faq/images/javafaq/ticked.gif </td><td align=center>/images/javafaq/ticked.gif </td></tr> | ||
<tr><td>Lossless</td><td align=center>http://www.oesf.org/faq/images/javafaq/ticked.gif </td><td align=center>http://www.oesf.org/faq/images/javafaq/unticked.gif </td><td align=center>/images/javafaq/unticked.gif </td></tr> | <tr><td>Lossless</td><td align=center>http://www.oesf.org/faq/images/javafaq/ticked.gif </td><td align=center>http://www.oesf.org/faq/images/javafaq/unticked.gif </td><td align=center>/images/javafaq/unticked.gif </td></tr> | ||
Revision as of 00:15, 5 December 2004
Main
Where did this Java FAQ come from?
- This FAQ has been contributed by Gerald J. Normandin Jr.
It has been found at http://adorphuye.com/zaurus/java/faq.jsp
The original author of this FAQ is Steph Meslin-Weber, mailto:twiun@adorphuye.com. A fair number of people have also contributed in various ways by providing information, links or criticism:
- All the fine folks on the [zaurus-java] mailing list
- Andrew Girow
- Gurminder Khamba
- Jim Huang
- John Barrus
- Pierre MÈ tras
- Rehana Ramzan
- Steve Weyer
- Steve Yegge
- didge
- Leticia Golubov
- Peter Harverson
Java Extensions
What extensions?
- Java language extensions provide added functionality to the core Java api.
When Java 1.1 was released, additional extensions (Swing, Collections) were also released to make up for gaps in the api coverage.
As each new Java version ships, these extensions get included into the core api. Currently on the Zaurus, only PersonalJava 1.2 - equivalent to Java 1.1 - is available, and so we start looking at the api extensions for extra functionality. </ul>
Can I use Secure Sockets on the Zaurus?
- Thanks to Steve Weyer for providing this answer. So, at the expense of a bulky library, we can indeed use JSSE on the Zaurus.
From Steve Weyer:
(non JSSE things snipped)
regarding extensions, Sun's JSSE (Java Secure Socket Extensions) 1.0.2 works fine with PJ on Z. this allows https: connections among other things. I've used with my CrozzWord app for secure login to NYTimes subscription area. downside: it's ~420K </ul>
Can I use SVG on the Zaurus?
- Yes, it is now possible to use SVG on the Zaurus and indeed, on any J2ME/PersonalJava VM. I have tested TinyLine 1.2 on the Zaurus using the demo kindly sent to me by Andrew Girow and can say that it performs very well. Downloads for this latest version of TinyLine are available from the TinyLine website.
Here are a few screenshots to give you an idea of the demo:
Can I use Swing?
- Before reading the answer consider this: Swing uses floating point coordinate systems and transformations - the Zaurus is based on the ARM SA-1100 chipset which does not have a floating point unit. The net result is that any floating point operation has to be emulated and that's very slow.
Short answer: No.
Long answer: Swing can be used on the Zaurus with the Jeode VM but you must use the unbundled Swing distribution1 and you must edit SwingUtilities.java in that distribution. This is due to a Swing bug2 that will not be fixed by Sun. Also note that certain parts of Swing use native code which is currently unavailable for the ARM platform; this means parts of Swing will not work.
Note: Because of the Sun License, I cannot redistribute modified Swing sources or jar files.
Instructions taken from the bugparade report2:
1. Extract the src.zip (from the swing-1.1.1fcs distribution). 2. in javax/swing you'll find the SwingUtilities.java file. 3. Open it your favorite editor 4. Comment out line 677:
Method m = Class.class.getMethod ("getProtectionDomain", null);
5. Insert the line
Method m = Class.class.getMethod ("getPackage", null);
just after the old one.
6. Save and compile (javac -classpath swingall.jar:. javax/swing/SwingUtilities.java) 7. Backup the Swingall.jar archive in the root of the exstracted src.zip (ie the same level of the javax and com dirs). 8. Jarize it (jar uvf swingall.jar javax/swing/SwingUtilities.class)
11Unbundled JFC 1.1 with Swing 1.1.1
2Bug Id #4309057
Miscellaneous
What Classes can I use?
- Jeode supports the PersonalJava 1.2 Specification. As this specification is compatible with jdk1.1.8, you can make/port your program using the jdk1.1 classes.
(It is apparently still possible to use JNI, obviously, use at your own discretion)
NOTE: This excludes all the J2SE Classes (Swing, JMF, JAI, etc)
What graphic file formats does Jeode support?
- The PersonalJava spec only requires gif, jpg and png support for compliance and so those formats are supported to some degree.
| GIF | JPG | PNG | |
| Paletted | http://www.oesf.org/faq/images/javafaq/unticked.gif | /images/javafaq/unticked.gif | |
| TrueColour | http://www.oesf.org/faq/images/javafaq/unticked.gif | http://www.oesf.org/faq/images/javafaq/ticked.gif | /images/javafaq/ticked.gif |
| Lossless | http://www.oesf.org/faq/images/javafaq/ticked.gif | http://www.oesf.org/faq/images/javafaq/unticked.gif | /images/javafaq/unticked.gif |
| Transparency | http://www.oesf.org/faq/images/javafaq/ticked.gif | http://www.oesf.org/faq/images/javafaq/unticked.gif | http://www.oesf.org/faq/images/javafaq/ticked.gif |
</ul>
Can I develop ON the Zaurus?
- Absolutely!
The build-in keyboard makes this an ideal use for the Zaurus, although you'd probably be faster on a desktop machine. The keyboard on the Zaurus is not, in my opinion, intended for writing novels ;-)
Because of the limited memory footprint of the Zaurus you shouldn't expect to be able to run, say, NetBeans, but with an editor and a compiler you should be set to go!
So far, compilers that run on the Zaurus include Kopi and Jikes.
Editors can include:
- EIDE a small Java ide for the Zaurus
- Built-in Text editor
- Built-in VI
- tkcEditor
- kVim (not available yet)
Additionally, Pierre MÈ tras has written a HOWTO based on MinIDE+Kopi at http://www.alterna.tv/jsearch/. As this HOWTO is in French, I'm in the process of translating it into English - should be finished in a few days. (Current translation at here)
Can I play sounds using Java?
- Previously, people did not seem to have had any success using the normal Applet.play() methods, having limited success using the undocumented and unsupported sun.audio and writing directly to the /dev/dsp device using a FileOutputStream (thanks Ralph Curtis, John McDonnell and Henry Gunst).
This is now changing, with thanks to didge for the information:
I have been able to use the Java Media Frameworks to play sounds on my SL5500. Here are instructions:
Using JMF2.1.1b (the cross-platform version) to play .wav files on the Zaurus can be achieved by doing the following:
Create your own custom.jar (using JMFCustomizer w/ jdk1.4). Check the following items:
- Media Source: Media Files, RTP Receive
- Media Sink: Play
- Optional Component: Player bean
- Protocol: file, rtp
- Source Media Formats: Wav
- Decoder/Audio Decoders: none
- Decoder/Video Decoders: none
- Encoder/Audio Encoders: none
- Decoder/Video Encoders: none
- DePacketizer/Audio DePacketizers: none
- DePacketizer/Video DePacketizers: none
- Packetizer/Audio Packetizer: PRTP_MP3/2
- Packetizer/Video Packetizer: none
- Audio Renderer: SunAudio
- Video Renderer: none
Make sure that custom.jar and jmf.properties are located in your classpath. Additionally, you will need to start Jeode with the following arguments:
- -Djeode.evm.memory.overallSize=5m
- -bootclasspath #SYSTEM#:$CLASSPATH
Any caveats or things I should watch out for?
- There are a few things to watch out for when developing or releasing for the Zaurus...
- Watch that ipk filename! It should be all lowercase and follow the naming conventions that ipkg-build warns you about.
- Images in memory are in 16bpp... bear that in mind when loading them for display. Use tiling and progressive loading to save on memory as images such as (one screen full) 320x240x16bpp = 153kb, (digital camera resolution) 1600x1200x16bpp = 3,840kb!
- Ensure that the control file in an ipk has the all the required fields, it won't show up otherwise!
- Use unix newline characters to terminate lines in control/.desktop/script files! (unix='n', windows='nr') (thanks to Ralph Curtis)
What class libraries are available for the Zaurus?
- There are a few class libraries available for the Zaurus, and indeed for PersonalJava and J2ME. As a rule of thumb, the majority of Java 1.1 libraries will work without problem - this is of course not taking performance or size into consideration.
Lightweight AWT GUI toolkits (or why be stuck with AWT?)
- Thinlets (~24k, slow, attractive)
- ICEToolkit (~120k, slow)
- Dog.Gui (~356k, fast)
- [1] (sluggish)
- KFC (~570k, fast)
- Zaval lwvcl (~130k, fast)
XML Parsers (or why make do with properties files?)
Databases (or why settle for flat files?)
- Hypersonic SQL aka hsqldb (~110k, Java1.1/1.2, JDBC)
- SQLite (native ODBC bindings)
Cryptography (or why keep things simple?)
Problems with java.util.Date & Co.
- I recently got some questions regarding this, and here are some snippets from the ZaurusZone forums, from the user kevinlong - when the forums are back online, I'll also provide a direct link:
Posted: April 21 2002,19:21
It appears there maybe a problem accessing the time on the device. I've tried using both the Date() and the GregorianCalendar() classes.
This problem appears to be dependent on which city you select. For example, if you select Chicago or Los Angeles, the time appears to return correctly. However, if you select a city such as Kansas City, Oslo, Hong Kong, the time returned is the GMT time instead of the local time. In other words, the GMT time and local time are the same. When you query the time zone offset, it is 0.
I should note that the time always appears correctly in the sytem tray on the device.
Any ideas?
Posted: April 25 2002,03:19
I have been exchanging emails with Sharp (Japan). They have located the problem in the Insignia code. They are waiting on a fix or work around from Insignia.
In short, Java supports a much smaller list of cities than the Zaurus. When a city isn't found, it defaults to GMT for the time zone. Oooops!
I will post an update when I get a final response from Sharp and Insignia.
Posted: May 11 2002,23:58
I have heard back from Sharp regarding this problem. Insignia has stated they only support the following cities: Africa/Casablanca Europe/Paris Africa/Cairo Asia/Riyadh Asia/Tehran Asia/Yerevan Asia/Karachi Asia/Calcutta Asia/Dacca Asia/Bangkok Asia/Shanghai Asia/Tokyo Australia/Darwin Australia/Sydney Pacific/Guadalcanal Pacific/Fiji Pacific/Apia Pacific/Honolulu America/Anchorage America/Los_Angeles America/Denver America/Chicago America/New_York America/Caracas America/St_Johns America/Buenos_Aires America/Sao_Paulo Atlantic/Cape_Verde America/Costa_Rica Asia/Beirut Africa/Johannesburg Asia/Jerusalem Europe/Moscow Asia/Vladivostok Australia/Hobart
Sharp has told me that Insignia does not plan to fix it. Even though they are under contract to Sharp, Sharp is not going to press Insignia to fix it.
If you would like this fixed, I would recommend that email is sent to both Sharp and Insignia. The developer support email for Sharp is kpda_pt@pda.nara.sharp.co.jp. I could not find a support email for Insignia.
Hopefully, if enough people complain, they will get this problem fixed.
I agree that this is an issue that should be resolved. The Zaurus is after all an international device. </ul>
Can I learn Java on the Zaurus?
- Like all things, this is of course possible BUT:
One thing I'd like to make clear is that I don't think any PDA is suitable for learning Java (and quite likely other languages).
You need a flexible environment and be able to debug, type and browse documentation easily and fast. You won't be able to do all that on a PDA.
The Java tutorial at Sun isn't a 400-page book, it has valid examples for you to work with and very good explanations, as well as instructions on getting Java working on the desktop OS of your choice: http://java.sun.com/docs/books/tutorial/index.html
Java on the Zaurus is still pretty much stuck at version 1.1, this means that once you've learnt the Java syntax, get hold of a 1.1 Java sdk and use this for development on your desktop. It's of course possible to use later versions for this, but doing so may lead to more headaches further on.
I, like most others, do my Java development on the desktop in any case - the compiled code will (should) run without modification on the Zaurus if you work within the Java 1.1 specs. So there isn't a dire need for tools for use on the Zaurus. This is not to say there aren't any - there are quite a few: 2 compilers, 2 virtual machines (2 more on the way), 3 IDEs and countless class libraries that work perfectly fine on the small form factor.
So with regards to development tools for use on the Z, I'd say hold on, learn Java first :-)
I heartily recommend the #java channel on irc.freenode.net for help with learning Java, make sure you've read the Java tutorial first though - you'll get flak if you don't ;-) </ul>














