Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!

Difference between revisions of "Java"

From Openembedded.org
Jump to: navigation, search
m (Reverted edits by Cbrake (Talk); changed back to last version by 193.171.32.6)
(Undo revision 1837 by 193.171.32.6 (Talk))
Line 7: Line 7:
 
comment4
 
comment4
  
comment3
+
=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.'''
 +
 
 +
==java-native.bbclass==
 +
If you use the ''java-library'' bbclass in a recipe ''foo'' and generate a native variant (e.g. ''foo-native'') you should use
 +
 
 +
  inherit java-native
 +
 
 +
instead of ''native''. By doing so, you make sure, that any jars created by the recipe are properly installed into staging.
 +
 
 +
==ant-native==
 +
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 =
 
= Information on specific libraries =

Revision as of 16:41, 6 November 2009

This page is here to answer all things Java related to OpenEmbedded.

comment3

comment6

comment4

Contents

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.

java-native.bbclass

If you use the java-library bbclass in a recipe foo and generate a native variant (e.g. foo-native) you should use

 inherit java-native

instead of native. By doing so, you make sure, that any jars created by the recipe are properly installed into staging.

ant-native

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

Version suggestions

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"

libecj-bootstrap

 PREFERRED_VERSION_libecj-bootstrap = "3.4"

Extra binaries and symlinks

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.

Future plans

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.

FAQ

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?

I found these articles in Wikipedia helpful to clarify the situation Java platform, Java ME.

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.

Personal tools
Namespaces

Variants
Actions
Navigation
Categories
OE services
Toolbox