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 fileoe_makeclasspath
: This generates a classpath string from JAR filenamesoe_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...