Welcome!

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

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
    Recently, WebRTC has a lot of eyes from market. The use cases of WebRTC are expanding - video chat, online education, online health care etc. Not only for human-to-human communication, but also IoT use cases such as machine to human use cases can be seen recently. One of the typical use-case is remote camera monitoring. With WebRTC, people can have interoperability and flexibility for deploying monitoring service. However, the benefit of WebRTC for IoT is not only its convenience and interopera...
    The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
    SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
    Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
    No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
    Product connectivity goes hand and hand these days with increased use of personal data. New IoT devices are becoming more personalized than ever before. In his session at 22nd Cloud Expo | DXWorld Expo, Nicolas Fierro, CEO of MIMIR Blockchain Solutions, will discuss how in order to protect your data and privacy, IoT applications need to embrace Blockchain technology for a new level of product security never before seen - or needed.
    In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
    Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
    A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
    "Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
    Digital Transformation (DX) is not a "one-size-fits all" strategy. Each organization needs to develop its own unique, long-term DX plan. It must do so by realizing that we now live in a data-driven age, and that technologies such as Cloud Computing, Big Data, the IoT, Cognitive Computing, and Blockchain are only tools. In her general session at 21st Cloud Expo, Rebecca Wanta explained how the strategy must focus on DX and include a commitment from top management to create great IT jobs, monitor ...
    "Digital transformation - what we knew about it in the past has been redefined. Automation is going to play such a huge role in that because the culture, the technology, and the business operations are being shifted now," stated Brian Boeggeman, VP of Alliances & Partnerships at Ayehu, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
    SYS-CON Events announced today that Evatronix 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. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
    To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
    Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
    With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
    22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
    22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...