This page is here to answer all things Java related to OpenEmbedded.
- 1 Writing a Java recipe
- 2 Information on specific libraries
- 3 Caveats, known issues, hints, miscellaneous information
- 4 Future plans
- 5 FAQ
Writing a Java recipe
This section is going to tell you, how to write a proper recipe to build a Java library or program.
At the moment this is a stub and you will only find some scattered information which at a later point will be merged into a consistent whole.
If you use the java-library bbclass in a recipe foo and generate a native variant (e.g. foo-native) you should use
instead of native. By doing so, you make sure, that any jars created by the recipe are properly installed into staging.
If you need Ant to build your recipe add ant-native to your recipes dependencies. This will allow you to call the built-in Ant executable.
Information on specific libraries
swt3.4-gtk and swt3.4-gtk-hildon
Some effort has been done to integrate Gtk+-based SWT 3.4 into the Hildon environment (that is what Maemo provides). Distributions targeting Maemo should set the preferred provider for swt3.4-gtk like this:
PREFERRED_PROVIDER_swt3.4-gtk = "swt3.4-gtk-hildon"
Important: If you do not want the hildon variant it is best to declare
PREFERRED_PROVIDER_swt3.4-gtk = "swt3.4-gtk"
as well. So bitbake will not chose the wrong one by accident (which would otherwise pull in all kinds of unwanted dependencies).
Caveats, known issues, hints, miscellaneous information
Everyone and his dog knows that combining glibc 2.8, gcc 2.95 and Linux kernel 2.6.26 is not going to work. In the GNU Classpath realm we also have a set of versions that do not fit together. Here are some suggestions for your PREFERRED_VERSIONs. Stick to these if you are unsure. You can always find out which version are supposed to be compatible by reading the READMEs of the VMs.
jamvm-initial and classpath-initial
Use this and nothing else:
PREFERRED_VERSION_jamvm-initial = "1.4.5" PREFERRED_VERSION_classpath-initial = "0.93"
cacao-initial and classpath-initial
Use this and nothing else:
PREFERRED_VERSION_cacao-initial = "0.98" PREFERRED_VERSION_classpath-initial = "0.93"
jamvm[-native] and classpath[-native]
These are the releases that appear to be stable.
PREFERRED_VERSION_jamvm-native = "1.5.3" PREFERRED_VERSION_classpath-native = "0.98"
For the target device:
PREFERRED_VERSION_jamvm = "1.5.2" PREFERRED_VERSION_classpath = "0.98"
cacao[-native] and classpath[-native]
These releases appear to be stable:
PREFERRED_VERSION_cacao-native = "0.99.3" PREFERRED_VERSION_classpath-native = "0.97.2"
For the target device take these:
PREFERRED_VERSION_cacao = "0.99.4" PREFERRED_VERSION_classpath = "0.98"
PREFERRED_VERSION_libecj-bootstrap = "3.4"
Since both Cacao and JamVM can be installed in staging you can use this and modify the 'java' or 'java-initial' symlink if you want to switch to a certain VM.
Debugging Cacao on the target
You need to debug the Cacao JVM on your target device using GDB and need some pointers on how to get started? Read this page from the Jalimo Wiki.
Default Bytecode compliance level
Soon an option will be introduced to set the default bytecode compliance level. For any Java package that does not explicitly provide this level (not many do this) the one you set in your configuration will be used.
OpenJDK + Cacao
The flexibility of the Cacao runtime allows it to run it with OpenJDK's class library. This allows you to use the official class library and a JIT-capable runtime on an ARM device (as of today Hotspot has no JIT on ARM).
Since the middle of August 2008 OpenJDK + Cacao can be build and is included in the Debian armel sid repositories (package cacao-oj6-sdk). Xerxes Rånby is showing some webbapplets running using OpenJDK + CACAO on his blog: http://labb.zafena.se/?p=1
Since December 2008 OpenJDK + Cacao can be crosscompiled with OpenEmbedded as demonstrated by Robert Schuster! Check out http://rschuster.blogs.evolvis.org/2008/12/21/serving-cross-compiled-openjdk-with-icedtea/ and the answers http://rschuster.blogs.evolvis.org/2008/12/23/comments-on-latest-post-on-openjdk/
Ant integration for build recipes
Although ant can be used as a standalone tool there is no direct support for it in the recipe. E.g. the Debian buildsystem (CDBS) has support classes that can be used for Ant-based Java sourcepackages. It would be nice to have this too for OpenEmbedded.
This space is for *your* questions and those that appeared more often on the mailing list. Things will be added here by the Jalimo folk/OE-Java maintainers or by you asking a question.
Q: I do get all these editions, configurations and profiles that exist in the Java world wrong. Any pointer on this?
Q: I need to solve a specific Java problem in OE and want to throw money at this. Whom can I contact?
The Jalimo project has done a lot of Java work in OE and are available for contract work. You can also ask for experienced devs on the openembedded-devel mailing list.