11 Develop and Test Your Embedded Application
This chapter describes techniques for developing, testing, and compiling your embedded application. It applies to both headless and headful applications.
This chapter contains the following topics:
For information that is unique to headful applications, see Develop Headful Applications.
For an overview of the development process, see Quick Start for Application Developers.
Develop Your Application
Develop applications on a host computer with a full JDK. You can use the Java application development tools of your choice. See, for example, Developing Embedded Applications in NetBeans IDE.
As you refer to the standard JDK documentation, use the information in the API documentation about compact profiles to ensure that you are working within the constraints of the JRE that will be installed on the embedded device. See Determining Compact Profiles for API Objects.
Test Your Application on the Host Computer
Test your application frequently to ensure that your application will run under the compact profile that is included in your custom JRE. There are two standard JDK tools that check the profile:
Compile with the javac Tool and the -profile Option
When you compile your application with the javac tool, specify the profile installed on the target device with the -profile option to test whether all the APIs in your application are included in the profile that be included in your custom JRE.
For example, the following command compiles the application and at the same time tests to make sure that all of your APIs are included in the
$ javac -profile compact1 Hello.java
Hello.java uses an API that is not present in the
compact1 profile, the compiler detects the error.
Use the jdeps Tool to Test Minimum Required Compact Profile
After compiling, you can use the
jdeps dependency analyzer tool with the
-P option to determine the minimum compact profile required for each class in your application. For example:
% jdeps -P HelloWorld.class
Here is an example of the output:
HelloWorld.class -> /net/test11.us.example.com/export/java-re/jdk/8/ea/b124/binaries/linux-i586/jre/lib/rt.jar <unnamed> (HelloWorld.class) -> java.io compact1 -> java.lang compact1
In this example, both classes used in the application minimally require the
Testing Your Application on the Target Device
Occasionally you should test your application on the target device, and when the application is final, deploy it. See Deploy Embedded Applications.