Movatterモバイル変換


[0]ホーム

URL:


Country
Contact Sales
Java SE Embedded System Requirements

Oracle Java Micro Edition Embedded Client - Getting Started

Getting Started With The Oracle Java ME Embedded Client

Introduction

Installing Linux on an ARM-based BeagleBoard describes how to get Linux running on a BeagleBoard. This article describes how to create a Java application using NetBeans and how to run that application on the BeagleBoard using the Oracle Java Micro Edition Embedded Client (Oracle Java ME Embedded Client).

Obtaining the required software

Download the following:

Oracle Java ME Embedded Client for ARM

This is the Java platform that runs on the BeagleBoard. You will install it later in this article.

Oracle Java ME Embedded Client for x86

This package for x86 is the same Java platform software as the ARM package, but it runs on your computer and acts as a device simulator. This means you can write and test applications in a tight development cycle. When you get your application running well on your computer, you can start testing on a real device like the BeagleBoard. After you download this package, install it.

alix@livadia:~$ sudo chmod +x ojec_1.0_linux_x86_sdk.binalix@livadia:~$ sudo ./ojec_1.0_linux_x86_sdk.binOracle Java Micro Edition Embedded Client version 1.0 Installeris starting, please wait...1 - Install2 - Uninstall3 - QuitEnter choice: 1Installing Oracle Java Micro Edition Embedded Client version 1.0...Installation completed.alix@livadia:~$

NetBeans version 6.9.1 or later

NetBeans is the Integrated Development Environment you use to create applications. Install NetBeans now.

Hooking up NetBeans

This section describes how to tell NetBeans about the Oracle Java ME Embedded Client so you can use it to create applications.

The following instructions were tested on an Ubuntu 10.04 system, but they should also apply to Windows. For more information, see theInstallation Guide.

Start NetBeans, then selectTools > Java Platforms from the menu.

java platform manager

ClickAdd Platform...

add java platform

SelectJava ME CDC Platform Emulator, and clickNext >.

Select Java ME CDC Platform Emulator, and click Next >.

Go to the Oracle Java ME Embedded Client. The location depends on your operating system.

  • Linux:/usr/local/Oracle_JavaME_Embedded_Client
  • Windows 32-bit:C:\Program Files\Oracle\Oracle JavaME Embedded Client
  • Windows 64-bit:C:\Program Files (x86)\Oracle\Oracle JavaME Embedded Client

Select theemulator-platform subdirectory, and clickNext >.

Go to the Oracle Java ME Embedded Client. The location depends on your operating system.

Enter a name for the platform or accept the default, and clickFinish.

Select the emulator-platform subdirectory, and click Next >.

The Java platform you just added is in the list. ClickClose.

Creating a NetBeans project

This section describes how to create your first application for the Oracle Java ME Embedded Client.

SelectFile > New Project... from the NetBeans menu.

InCategories, selectJava ME. InProjects, selectCDC Application. ClickNext.

Enter a name for the platform or accept the default, and click Finish.

Change the project name and location if you wish. DeselectCreate Main Class and clickNext.

The Java platform you just added is in the list. Click Close

NetBeans creates a new project.

Creating source code

This section describes how to write source code for your application.

In theProjects pane of the NetBeans window, right-click the project and selectNew > Java Class... from the menu.

Enter a class name and a package name. ClickFinish. NetBeans supplies a skeleton of the class. Fill in an implementation that writes to the console:

package hello;public class HelloMain {  public static void main(String[] args) {    System.out.println("Hello, Oracle Java Micro Edition Embedded Client!");  }}

Tell NetBeans thatHelloMain is the main class of the project. Right-click the project, then selectProperties (at the bottom of the menu). On the left side of the window, clickRunning. ClickBrowse, then select the class you just created.

In Categories, select Java ME. In Projects, select CDC Application. Click Next.

Now that you downloaded and installed the software and know how to create an application using NetBeans, you can run your application on your desktop computer by clicking the button with the green triangle, pressing the F6 key, or selectingRun > Run Main Project from the menu.

If you do not see anOutput window, press Ctrl 4. In that window, you see the output of your application running on the Oracle Java ME Embedded Client:

Hello, Oracle Java Micro Edition Embedded Client!

Running your application on the BeagleBoard

This section describes how to take the application you just created and run it on the BeagleBoard using the Oracle Java ME Embedded Client.

First, install the Oracle Java ME Embedded Client on the BeagleBoard. If you have your computer networked to the BeagleBoard, as described inInstalling Linux on an ARM-Based BeagleBoard, then copying files over the network is easy. For example, if the BeagleBoard is at IP address 10.42.43.10 in your network, you can copy the Oracle Java ME Embedded Client archive:

alix@livadia:~$ scp Downloads/ojec_1.0_linux_arm_sdk.tar.gz \ubuntu@10.42.43.10:/home/ubuntuThe authenticity of host '10.42.43.10 (10.42.43.10)' can't be established. RSA key fingerprint is 4e:eb:40:26:5a:61:26:65:87:8e:3c:06:2a:86:df:10. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.42.43.10' (RSA) to the list of known hosts. ubuntu@10.42.43.10's password: ojec_1.0_linux_ar.tar.gz                                                                                          100% 8797KB   8.6MB/s   00:05alix@livadia:~$

In the BeagleBoard console, unpack the archive:

ubuntu@omap:~$ tar zxvf ojec_1.0_linux_arm_sdk.tar.gz

If you are impatient, run the Java Virtual Machine now. You will see an error message that states you have not specified a main class, but you can verify that it runs.

ubuntu@omap:~$ Oracle_JavaME_Embedded_Client/binaries/production/bin/cvm Main class name missing.usage: cvm [-fullversion] [-showversion] [-version] [-help] [-D<property>=<value>] [-XbuildOptions] [-XshowBuildOptions] [-XappName]ubuntu@omap:~$

Copy your application to the BeagleBoard. NetBeans packages your application as a JAR file in adist subdirectory of the project directory. Here is one example (on your computer again) of copying the application package to the microSD card:

alix@livadia:~$ scp NetBeansProjects/CdcApplication1/dist/CdcApplication1.jar \ubuntu@10.42.43.10:/home/ubuntu

Try your application on the BeagleBoard:

ubuntu@omap:~# Oracle_JavaME_Embedded_Client/binaries/production/bin/cvm \-cp CdcApplication1.jar hello.HelloMain                                  Hello, Oracle Java Micro Edition Embedded Client!                               ubuntu@omap:~#

You just ran your first application on the Oracle Java ME Embedded Client on ARM hardware!

If the command line is too cumbersome, you can simplify it:

ubuntu@omap:~# alias \cvm=/home/ubuntu/Oracle_JavaME_Embedded_Client/binaries/production/bin/cvmubuntu@omap:~# cvm -cp CdcApplication1.jar hello.HelloMainHello, Oracle Java Micro Edition Embedded Client!ubuntu@omap:~#

Summary

Installing Linux on an ARM-Based BeagleBoard describes how to prepare a memory card and run Linux on a BeagleBoard. This article describes how to use NetBeans to create an application for the Oracle Java ME Embedded Client. It also shows how to run that application on a desktop computer using NetBeans and how to run the same application on the BeagleBoard.

You now have the knowledge and tools to create Java applications for the Oracle Java ME Embedded Client for either x86 or ARM processors.


[8]ページ先頭

©2009-2025 Movatter.jp