Book Image

Embedded Linux Projects Using Yocto Project Cookbook

By : Alex Gonzalez
Book Image

Embedded Linux Projects Using Yocto Project Cookbook

By: Alex Gonzalez

Overview of this book

Table of Contents (13 chapters)
Embedded Linux Projects Using Yocto Project Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Integrating Java applications


The meta-java layer also offers helper classes to ease the integration of Java libraries and applications into Yocto. In this recipe, we will see an example of building a Java library using the provided classes.

Getting ready

The meta-java layer provides two main classes to help with the integration of Java applications and libraries:

  • The Java bbclass: This provides the default target directories and some auxiliary functions, namely:

    • oe_jarinstall: This installs and symlinks a JAR file

    • oe_makeclasspath: This generates a classpath string from JAR filenames

    • oe_java_simple_wrapper: This wraps your Java application in a shell script

  • The java-library bbclass: This inherits the Java bbclass and extends it to create and install JAR files.

How to do it...

We will use the following meta-custom/recipes-java/java-helloworld/java-helloworld-1.0/HelloWorldSwing.java graphical Swing hello world as an example:

import javax.swing.JFrame;
import javax.swing.JLabel;

public class HelloWorldSwing...