Welcome!

IBM Cloud Authors: Elizabeth White, Pat Romanski, Yeshim Deniz, Liz McMillan, Carmen Gonzalez

Related Topics: IBM Cloud

IBM Cloud: Article

Personal Java Development with WebSphere Studio Application Developer

Utilizing WSAD to develop and deploy Java code

This article is intended to help you understand what support the Sony-Ericsson P800/P900 has for Java and to show you how to install the necessary Symbian software required for developing Java solutions for these platforms. It will discuss how WebSphere Studio Application Developer can be used to develop the Java code, how this code can then be packaged using the Symbian development kit utilities, and how to deploy it to the Symbian P800/P900 emulator.

The Sony-Ericsson Px range is one of the new breeds of smartphones that combines phone functionality with that of a PDA. The Px smartphones provide you with GSM tri-band capability along with GPRS support. The phones use Symbian OS v7 with 12MB of internal user storage and a maximum of 128MB external user storage, provided by the Sony Memory Stick Duo card format. The screen size is 208 x 320 pixels in 4096 colors (65K colors for the P900). The phones have a flip cover that becomes a "virtual" flip if removed. With the flip closed, 208 x 144 pixels are visible. When the flip is open, the screen becomes touch sensitive.

The Symbian Px range provides support for Personal Java and MIDP/CLDC. The P800 provides support only for MIDP 1.0, whereas the newer P900 offers support for MIDP 2.0. MIDP 1.0 applications developed for the P800 should be compatible with the P900 as well.

For MIDP development, you can use IBM's Websphere Device Developer or Sun's Wireless toolkit to produce MIDP-compliant JAR files. These can then be deployed directly to the phone or to the emulator. Note that the P800 does not use the JAD file. The JAD file itself is not required by the MIDP 1.0 specification. Instructions on the various ways to install Midlets to the P800, including over-the-air (OTA) provisioning, can be found in the Symbian Knowledge Base entry listed in the Resources section.

The Personal Java implementation is based on JDK1.1.6, with some device-specific extensions as well as some restrictions. Personal Java has significant support on both PDAs and smartphones and provides a fully-fledged JVM that is not tied by the MIDP size restrictions, and has the capacity to utilize the external storage format. This, coupled with the ability to use AWT from a UI perspective, provides a capable platform for Mobile Application Development.

I find that one of the biggest challenges to individuals wishing to pursue mobile development is understanding what is needed and how to set up the environment. To enable development of Personal Java applications for the Sony Ericsson Px series, you first need to download the full Symbian/UIQ software development kit. This is free of charge and is available at developer.sonyericsson.com. The P800 supports the Symbian OS 7.0 UIQ 2.0 and the P900 supports Symbian OS 7.0 UIQ 2.1. UIQ is an acronymn for "User Interface Quartz". Quartz refers to one of the three original reference designs produced by Symbian. It defines a family of devices. UIQ 2.0 and 2.1 are used by the Px Series whereas Series 60, for example, is used by the Nokia Communicator Smartphones.

We will choose to develop against UIQ 2.0 because anything compiled and deployed with it will work on both the P800 and the P900. The SDK is comprised of a Perl Interpreter, a P800 emulator, as well as the required Java libraries and examples. Exactly why the environment is such a cluster of technologies is not entirely clear, and hopefully this will be updated and streamlined sometime soon.

After you have downloaded the separate installation packages, you need to install these onto a Windows-based OS. There are instructions provided on how to do this, but I would also like to add that, on installing the SDK, when asked what to install, select 'everything' when you are asked what to install. Even if you don't plan to develop in C++, I would suggest installing this part, as my experience suggests that you will have problems later only if you fail to install it. For those of you who are using Linux as your development platform, it is possible to enable development for Symbian UIQ devices on Linux but it is outside the scope of this article.

Once you have installed the Symbian software, there are a few things that need to be done to ensure that the development environment and emulator are set.

The first thing you need to do is to set the 'EPOCROOT' environment variable. I suggest you do this via the Windows environment variables settings. Set this to \Symbian\UIQ_70\ .

As Symbian OS Kits are designed to support developers who need to work on different projects targeting different types of phones, you next need to register the correct device with the environment. This is done using the 'devices.exe' command at the command prompt. To do this, run the devices command: 'devices -setdefault @UIQ_70:com.symbian.UIQ'. You need only do this once, as the device details are saved in the environments configuration file. This is actually an XML file which can be found at 'c:\Program Files\Common Files\Symbian\devices.xml.'

The emulator maps the Symbian OS file system onto the PC's file system. It performs this drive mapping at run-time. The emulator needs to have two default drives: z:, which maps to the phone's ROM, and another which represents the primary writable file system on the phone. Both drives should be pre-configured, but if you are having problems, then you can look inside epoc.ini with a text editor. This can be found at <Symbian Install DIR>\UIQ_70\epoc32\data\. If it does not already exist, you can create it. An example is given below:

_epoc_drive_j D:\Symbian\UIQ_70\epoc32\java

You can add further virtual drives, and reconfigure the standard drives to map to alternative locations, however any mapping for the z: drive must specify a directory named z.

The emulator can now be launched by invoking the emulator launcher 'epoc' from the command line. This invokes and runs the emulator executable file epoc.exe for the currently active device, as defined by the devices command that we previously set. If everything has been set correctly, the emulator should launch (see Figure 1).

Once you have the software installed you essentially have:

  • A mobile phone emulator that has been customized for the P800
  • A 'virtual' Windows file system-based implementation of the phone directory structure
  • Software tools that are able to package the Java JAR files into a 'SIS' file that is the default file format for applications on the P800/900
  • Personal Java documentation for the P800/900
The UIQ SDK contains several Java libraries. The libraries of note are:
  • classes.zip: The Personal Java API library
  • qawt.jar: Provides support for the UIQ look and feel; a modification of the Java AWT Frame class.
  • javaphone.jar: The JavaPhone API library
  • util.jar: A library to provide access to Symbian OS utilities.
For reference, the classes.zip library is located in the path epoc32/java/lib/ inside the UIQ installation. The other three libraries are located in epoc32/java/ext/.

When you build your Personal Java application on the Px series, you will need a mechanism to debug the deployed application while it is running on the emulator, i.e., receive output from Java's System.out stream. Fortunately, Ericsson provides this functionality in the form of a small application called 'Redirect'. It is not installed by default on the phone emulator, but can be found at <your-sdk-installation>\epoc32\winscw\c. Launch the P800 emulator and install this from the application Launcher menu, by selecting the Redirect.sis file.

To recap, we now have the UIQ SDK installed and the correct parameters set to allow us to use the emulator. We are now going to use WebSphere Studio Application Developer to compile a Personal Java application and use the Symbian SDK utilities to package it so that it can be installed to the P800 emulator.

Rather than build a small "Hello World" Personal Java application, we are going to take an existing Personal Java application and import it into WSAD. The Personal Java application we will use also addresses one of the criticisms of mobile development of Java compared to Mobile development for .NET, namely the lack of rich UI components such as tree, tab, etc.

Thinlet is a 'lightweight' UI toolkit that supports Java 1.0 to 1.4, Personal Java, as well as Personal (Basis) Profile. Swing isn't required. It comprises a single Java class that handles user interaction, and calls business logic. The graphic presentation is described in an XML file and the application methods are written as Java code. Its compressed size is 38KB, and it is LGPL licensed.

We are going to download the demo application, import this into WebSphere Studio, verify that it will compile and run against the Symbian Java API Library, and then use the Symbian SDK to package it and deploy it to the phone. The Thinlet download demo can be found at www.thinlet.com.

After you have downloaded the demo file, launch WebSphere Studio and choose to start a new Java project, which we will simply call Test. Ensure that you remove the default rt.jar library and add the classes.zip library from the Symbian directory.

Once the new project is created, we need to import the Thinlet demo into the project. Right-click the root level Test project, choose Import, and select File system. Navigate to the directory where you unpacked the Thinlet demo file and choose the 'src' directory. From the /src/thinlet directory we need to import the Thinlet.java and FrameLauncher.java runtime files. From the /src/thinlet/demo directory select all the files. Once the files have been added, rebuild all the project files from the Tools Menu.

You can now choose to run the demo.java file or the calculator.java file from within WebSphere Studio.

The next thing we need to do is to package this as a JAR file. Within WebSphere Studio, choose to export to a JAR file(file->export->jar file). Deselect the .classpath and .project files and choose the destination location. Note that you will need to generate the .manifest file to make the JAR executable. Choose thinlet.demo.Demo' as the executable main class for the application entry point. The Symbian phone refers to this when launching the application so it is important to ensure that this is correct. Save the JAR file as test.jar. Note that you should not use filenames over 8 characters, as the emulator will not recognize the file.

Now that we have the executable Personal Java JAR file, we need to package it so that it can be deployed and used on the Symbian phone.

AIF Builder is an application that is installed as part of the Symbian SDK and enables you to create the required Symbian files that need to exist before final packaging. These include an Application Information File (.aif), an application file (.app), and a text file that specifies the command line to the JVM when the application is launched. AIF Builder is invoked from the command line using 'AifBuilder'. This can be found at <Symbian Install DIR>\UIQ_70\epoc32\tools\AIFBuilder.bat.

Once AIF Builder is launched, select Java as the application language and enter the application name as 'test'. A unique identifier then needs to be entered for the application. You can use a number in the range 0x01000000 to 0x0fffffff for testing purposes. Each application has to have its own unique ID to run correctly. Commercial UIDs can be obtained from Symbian. We will use 0x01000035 as a test UID. Against the Java Command use Line text enter "-cp \system\Apps\test\test.jar thinlet.demo.Demo".

Under the UI Variants Tab select 'UIQ' and also the location to generate files. Here we can also choose to select the icons that we have developed for the application or we can invoke an icon creator from the create button. We won't select any that result in a default icon being used. The last thing to do is to select the language(s) that you wish to be supported under the Caption Tab.

Once all of the above has been completed, choosing generate will result in three files being created, test.app, test.aif, and test.txt.

We have one last remaining step to complete before we can generate the sis installation file that the phone emulator recognizes. This is to create a package file. Package control files (extension .pkg) define the files to be packaged in a sis installation file. These currently have to created by hand. Listing 1 shows the package file for our test application with self-explanatory comments.

Once you have typed this information into a text editor, save it in the same directory as the generated files, calling it test.pkg. We can now use this to generate the .sis file. Makesis is the installation file generator provided by Symbian and is located at:

<Symbian Install DIR>\UIQ_70\epoc32\tools\MAKESIS.exe.

Open a command line prompt within the directory where your generated files and package file resides. Executing the 'makesis' utility against the package file ('makesis test.pkg') will create a sis installation file called test.sis.

To enable you to install this file to the emulator, it has to be placed correctly within the virtual directory structure to enable the emulator launcher application to find it. The correct place for this is:

<Symbian Install DIR>\UIQ_70\epoc32\winscw\c.

Also note that you can quickly test the application before packaging it as a sis file by putting the .app, .aif, .txt, and JAR files directly within the emulator virtual directory structure at the following location:

<Symbian Install DIR>\\UIQ_70\epoc32\winscw\c\system\Apps\<Your App DIR>

No icon is installed, but the application can be started by browsing to the correct directory using QFileman, and the Symbian emulator file explorer tool, and selecting the .app file.

Launch the emulator and choose the install option and you will see the 'test.sis' package ready to install. Following the default install instructions will result in a new application being installed called "test". Once you have installed it, launch the application and you should see the same application that we ran within WebSphere Studio running directly on the phone itself (see Figure 6).

Summary
To recap, we have given an overview of the Symbian Smartphone Px series, described how to install the SDK, how to develop Personal java Applications in WebSphere Studio, and how to package and deploy them to the phone emulator.

The age of the smartphone/smartPDA is definitely upon us and there will undoubtedly be more organizations wishing to make use of this technology for corporate applications. Although Sun is positioning MIDP as the prevalent mobile standard, most of the high-end PDAs and smartphones are equipped with a Personal Java-based Virtual Machine. This includes PDAs such as the IPAQ, the Palm, and other smartphones such as the Blackberry. This environment is currently ideally suited as a platform for ubiquitously accessible mobile applications, whatever the device.

Resources

  • Symbian Knowledge Base article on deploying Midlets to P800: www3.symbian.com/faq.nsf/
  • Thinlet download demo: thinlet.sourceforge.net/thinlet-2004-03-07.zip
  • Obtaining Commercial UIDs from Symbian: UID@Symbiandevnet.com
  • Sony Ericsson Developer Network: UIQ SDK downloads can be found at developer.sonyericsson.com.
  • More Stories By Jim Liddle

    Jim is CEO of Storage Made Easy. Jim is a regular blogger at SYS-CON.com since 2004, covering mobile, Grid, and Cloud Computing Topics.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    @ThingsExpo Stories
    SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
    SYS-CON Events announced today that NetApp has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp em...
    Real IoT production deployments running at scale are collecting sensor data from hundreds / thousands / millions of devices. The goal is to take business-critical actions on the real-time data and find insights from stored datasets. In his session at @ThingsExpo, John Walicki, Watson IoT Developer Advocate at IBM Cloud, will provide a fast-paced developer journey that follows the IoT sensor data from generation, to edge gateway, to edge analytics, to encryption, to the IBM Bluemix cloud, to Wa...
    There is huge complexity in implementing a successful digital business that requires efficient on-premise and cloud back-end infrastructure, IT and Internet of Things (IoT) data, analytics, Machine Learning, Artificial Intelligence (AI) and Digital Applications. In the data center alone, there are physical and virtual infrastructures, multiple operating systems, multiple applications and new and emerging business and technological paradigms such as cloud computing and XaaS. And then there are pe...
    SYS-CON Events announced today that B2Cloud will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. B2Cloud specializes in IoT devices for preventive and predictive maintenance in any kind of equipment retrieving data like Energy consumption, working time, temperature, humidity, pressure, etc.
    DevOps at Cloud Expo – being held October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real r...
    SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
    SYS-CON Events announced today that Suzuki Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Suzuki Inc. is a semiconductor-related business, including sales of consuming parts, parts repair, and maintenance for semiconductor manufacturing machines, etc. It is also a health care business providing experimental research for...
    SYS-CON Events announced today that Fusic will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Fusic Co. provides mocks as virtual IoT devices. You can customize mocks, and get any amount of data at any time in your test. For more information, visit https://fusic.co.jp/english/.
    SYS-CON Events announced today that Ryobi Systems will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ryobi Systems Co., Ltd., as an information service company, specialized in business support for local governments and medical industry. We are challenging to achive the precision farming with AI. For more information, visit http:...
    SYS-CON Events announced today that Keisoku Research Consultant Co. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Keisoku Research Consultant, Co. offers research and consulting in a wide range of civil engineering-related fields from information construction to preservation of cultural properties. For more information, vi...
    SYS-CON Events announced today that Daiya Industry will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Daiya Industry specializes in orthotic support systems and assistive devices with pneumatic artificial muscles in order to contribute to an extended healthy life expectancy. For more information, please visit https://www.daiyak...
    SYS-CON Events announced today that Interface Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Interface Corporation is a company developing, manufacturing and marketing high quality and wide variety of industrial computers and interface modules such as PCIs and PCI express. For more information, visit http://www.i...
    SYS-CON Events announced today that Mobile Create USA will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Mobile Create USA Inc. is an MVNO-based business model that uses portable communication devices and cellular-based infrastructure in the development, sales, operation and mobile communications systems incorporating GPS capabi...
    In his session at @ThingsExpo, Greg Gorman is the Director, IoT Developer Ecosystem, Watson IoT, will provide a short tutorial on Node-RED, a Node.js-based programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using a wide range of nodes in the palette that can be deployed to its runtime in a single-click. There is a large library of contributed nodes that help so...
    Elon Musk is among the notable industry figures who worries about the power of AI to destroy rather than help society. Mark Zuckerberg, on the other hand, embraces all that is going on. AI is most powerful when deployed across the vast networks being built for Internets of Things in the manufacturing, transportation and logistics, retail, healthcare, government and other sectors. Is AI transforming IoT for the good or the bad? Do we need to worry about its potential destructive power? Or will we...
    SYS-CON Events announced today that mruby Forum will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. mruby is the lightweight implementation of the Ruby language. We introduce mruby and the mruby IoT framework that enhances development productivity. For more information, visit http://forum.mruby.org/.
    SYS-CON Events announced today that Nihon Micron will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Nihon Micron Co., Ltd. strives for technological innovation to establish high-density, high-precision processing technology for providing printed circuit board and metal mount RFID tags used for communication devices. For more inf...
    SYS-CON Events announced today that SIGMA Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. uLaser flow inspection device from the Japanese top share to Global Standard! Then, make the best use of data to flip to next page. For more information, visit http://www.sigma-k.co.jp/en/.
    With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.