Welcome!

IBM Cloud Authors: Yeshim Deniz, Pat Romanski, Liz McMillan, 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
    IoT solutions exploit operational data generated by Internet-connected smart “things” for the purpose of gaining operational insight and producing “better outcomes” (for example, create new business models, eliminate unscheduled maintenance, etc.). The explosive proliferation of IoT solutions will result in an exponential growth in the volume of IoT data, precipitating significant Information Governance issues: who owns the IoT data, what are the rights/duties of IoT solutions adopters towards t...
    With the introduction of IoT and Smart Living in every aspect of our lives, one question has become relevant: What are the security implications? To answer this, first we have to look and explore the security models of the technologies that IoT is founded upon. In his session at @ThingsExpo, Nevi Kaja, a Research Engineer at Ford Motor Company, discussed some of the security challenges of the IoT infrastructure and related how these aspects impact Smart Living. The material was delivered interac...
    No hype cycles or predictions of zillions of things here. IoT is big. 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, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...
    The Internet giants are fully embracing AI. All the services they offer to their customers are aimed at drawing a map of the world with the data they get. The AIs from these companies are used to build disruptive approaches that cannot be used by established enterprises, which are threatened by these disruptions. However, most leaders underestimate the effect this will have on their businesses. In his session at 21st Cloud Expo, Rene Buest, Director Market Research & Technology Evangelism at Ara...
    "When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    When growing capacity and power in the data center, the architectural trade-offs between server scale-up vs. scale-out continue to be debated. Both approaches are valid: scale-out adds multiple, smaller servers running in a distributed computing model, while scale-up adds fewer, more powerful servers that are capable of running larger workloads. It’s worth noting that there are additional, unique advantages that scale-up architectures offer. One big advantage is large memory and compute capacity...
    Artificial intelligence, machine learning, neural networks. We’re in the midst of a wave of excitement around AI such as hasn’t been seen for a few decades. But those previous periods of inflated expectations led to troughs of disappointment. Will this time be different? Most likely. Applications of AI such as predictive analytics are already decreasing costs and improving reliability of industrial machinery. Furthermore, the funding and research going into AI now comes from a wide range of com...
    We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
    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.
    In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), provided an overview of various initiatives to certify the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldwide re...
    SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 21st Int\ernational Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their ...
    Internet of @ThingsExpo, taking place October 31 - November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 21st Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devic...
    Amazon started as an online bookseller 20 years ago. Since then, it has evolved into a technology juggernaut that has disrupted multiple markets and industries and touches many aspects of our lives. It is a relentless technology and business model innovator driving disruption throughout numerous ecosystems. Amazon’s AWS revenues alone are approaching $16B a year making it one of the largest IT companies in the world. With dominant offerings in Cloud, IoT, eCommerce, Big Data, AI, Digital Assista...
    SYS-CON Events announced today that Cloud Academy named "Bronze Sponsor" of 21st International Cloud Expo which will take place October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara, CA. Cloud Academy is the industry’s most innovative, vendor-neutral cloud technology training platform. Cloud Academy provides continuous learning solutions for individuals and enterprise teams for Amazon Web Services, Microsoft Azure, Google Cloud Platform, and the most popular cloud com...
    SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business...
    SYS-CON Events announced today that GrapeUp, the leading provider of rapid product development at the speed of business, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market acr...
    SYS-CON Events announced today that Ayehu will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on October 31 - November 2, 2017 at the Santa Clara Convention Center in Santa Clara California. Ayehu provides IT Process Automation & Orchestration solutions for IT and Security professionals to identify and resolve critical incidents and enable rapid containment, eradication, and recovery from cyber security breaches. Ayehu provides customers greater control over IT infras...
    In his session at Cloud Expo, Alan Winters, an entertainment executive/TV producer turned serial entrepreneur, presented a success story of an entrepreneur who has both suffered through and benefited from offshore development across multiple businesses: The smart choice, or how to select the right offshore development partner Warning signs, or how to minimize chances of making the wrong choice Collaboration, or how to establish the most effective work processes Budget control, or how to ma...
    SYS-CON Events announced today that CA Technologies has been named "Platinum Sponsor" of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business - from apparel to energy - is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
    SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.