SYS-CON MEDIA Authors: Pat Romanski, Gary Arora, Zakia Bouachraoui, Yeshim Deniz, Liz McMillan

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: [email protected]
  • 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.


    Latest Stories
    Every organization is facing their own Digital Transformation as they attempt to stay ahead of the competition, or worse, just keep up. Each new opportunity, whether embracing machine learning, IoT, or a cloud migration, seems to bring new development, deployment, and management models. The results are more diverse and federated computing models than any time in our history.
    On-premise or off, you have powerful tools available to maximize the value of your infrastructure and you demand more visibility and operational control. Fortunately, data center management tools keep a vigil on memory contestation, power, thermal consumption, server health, and utilization, allowing better control no matter your cloud's shape. In this session, learn how Intel software tools enable real-time monitoring and precise management to lower operational costs and optimize infrastructure...
    "Calligo is a cloud service provider with data privacy at the heart of what we do. We are a typical Infrastructure as a Service cloud provider but it's been designed around data privacy," explained Julian Box, CEO and co-founder of Calligo, 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.
    Isomorphic Software is the global leader in high-end, web-based business applications. We develop, market, and support the SmartClient & Smart GWT HTML5/Ajax platform, combining the productivity and performance of traditional desktop software with the simplicity and reach of the open web. With staff in 10 timezones, Isomorphic provides a global network of services related to our technology, with offerings ranging from turnkey application development to SLA-backed enterprise support. Leadin...
    While a hybrid cloud can ease that transition, designing and deploy that hybrid cloud still offers challenges for organizations concerned about lack of available cloud skillsets within their organization. Managed service providers offer a unique opportunity to fill those gaps and get organizations of all sizes on a hybrid cloud that meets their comfort level, while delivering enhanced benefits for cost, efficiency, agility, mobility, and elasticity.
    DevOps has long focused on reinventing the SDLC (e.g. with CI/CD, ARA, pipeline automation etc.), while reinvention of IT Ops has lagged. However, new approaches like Site Reliability Engineering, Observability, Containerization, Operations Analytics, and ML/AI are driving a resurgence of IT Ops. In this session our expert panel will focus on how these new ideas are [putting the Ops back in DevOps orbringing modern IT Ops to DevOps].
    Darktrace is the world's leading AI company for cyber security. Created by mathematicians from the University of Cambridge, Darktrace's Enterprise Immune System is the first non-consumer application of machine learning to work at scale, across all network types, from physical, virtualized, and cloud, through to IoT and industrial control systems. Installed as a self-configuring cyber defense platform, Darktrace continuously learns what is ‘normal' for all devices and users, updating its understa...
    Enterprises are striving to become digital businesses for differentiated innovation and customer-centricity. Traditionally, they focused on digitizing processes and paper workflow. To be a disruptor and compete against new players, they need to gain insight into business data and innovate at scale. Cloud and cognitive technologies can help them leverage hidden data in SAP/ERP systems to fuel their businesses to accelerate digital transformation success.
    Concerns about security, downtime and latency, budgets, and general unfamiliarity with cloud technologies continue to create hesitation for many organizations that truly need to be developing a cloud strategy. Hybrid cloud solutions are helping to elevate those concerns by enabling the combination or orchestration of two or more platforms, including on-premise infrastructure, private clouds and/or third-party, public cloud services. This gives organizations more comfort to begin their digital tr...
    Most organizations are awash today in data and IT systems, yet they're still struggling mightily to use these invaluable assets to meet the rising demand for new digital solutions and customer experiences that drive innovation and growth. What's lacking are potent and effective ways to rapidly combine together on-premises IT and the numerous commercial clouds that the average organization has in place today into effective new business solutions.
    Keeping an application running at scale can be a daunting task. When do you need to add more capacity? Larger databases? Additional servers? These questions get harder as the complexity of your application grows. Microservice based architectures and cloud-based dynamic infrastructures are technologies that help you keep your application running with high availability, even during times of extreme scaling. But real cloud success, at scale, requires much more than a basic lift-and-shift migrati...
    David Friend is the co-founder and CEO of Wasabi, the hot cloud storage company that delivers fast, low-cost, and reliable cloud storage. Prior to Wasabi, David co-founded Carbonite, one of the world's leading cloud backup companies. A successful tech entrepreneur for more than 30 years, David got his start at ARP Instruments, a manufacturer of synthesizers for rock bands, where he worked with leading musicians of the day like Stevie Wonder, Pete Townsend of The Who, and Led Zeppelin. David has ...
    Darktrace is the world's leading AI company for cyber security. Created by mathematicians from the University of Cambridge, Darktrace's Enterprise Immune System is the first non-consumer application of machine learning to work at scale, across all network types, from physical, virtualized, and cloud, through to IoT and industrial control systems. Installed as a self-configuring cyber defense platform, Darktrace continuously learns what is ‘normal' for all devices and users, updating its understa...
    Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
    Addteq is a leader in providing business solutions to Enterprise clients. Addteq has been in the business for more than 10 years. Through the use of DevOps automation, Addteq strives on creating innovative solutions to solve business processes. Clients depend on Addteq to modernize the software delivery process by providing Atlassian solutions, create custom add-ons, conduct training, offer hosting, perform DevOps services, and provide overall support services.