Java IoT Authors: Pat Romanski, Liz McMillan, Yeshim Deniz, Elizabeth White, Zakia Bouachraoui

Related Topics: Java IoT, Mobile IoT, Machine Learning

Java IoT: Article

The Challenges of Porting a Java ME Application to Multiple Devices

Coping with idiosyncrasies, the unexpected, and complexity

However, it's important to keep the code clean of directives that refer to device names. Instead, the directives should refer to semantic capabilities of the application. For example, Device Y requires a slightly different address format in the communications module than all other devices due to its using a different communications protocol. Instead of having code like:

#if DEVICE=="Y"
address = formatDifferentAddress(address);


the code should read:

address = formatDifferentAddress(address);


The different behaviors should be extracted out as capabilities, and devices are attributed with these capabilities. For each device there will be a configuration file that contains details of the capabilities that the device requires, which, at build time, is translated into the correct preprocessor definitions. Table 1 illustrates an example device capability file. Observe that some of the capabilities are feature-based in that each device is expected to have a different value, like screen settings, and other capabilities are the result of bugs in the system. For example, a bug in the RMS writing module on a certain device could have resulted in special code that writes data at set intervals, which results in the RMS_WRITE_INTERVAL_MS capability.

Since ant is the most common way to build Java applications, it's recommended that this file be a properties file (see Table 2).

As with most tasks in the Java world, there's a tool that can help you manage device capabilities. J2MEPolish is an advanced open source build tool and GUI framework for Java ME applications and currently has a database of nearly 400 devices with a lot of predefined capabilities. Another recently released open source library, the J2ME Device DB project, boasts capabilities similar to J2MEPolish and is worth evaluating. There are also several commercial packages available that address these problems that can be found on the Web.

Flexible Builds
Having a Java ME application that's supported on a large number of devices means that you have to make a large number of builds when releasing versions for testing or QA. Manually building devices might be acceptable for a few devices, but when the number increases, you'll have to have a way of batch building applications for all devices or for a particular subset of devices. Again, J2MEPolish has a good ant-based build framework sufficient for most needs.

However, when each customer needs multiple languages, and possibly different feature sets, the build process will get more complicated. For each device there might be different language options combined with several different feature sets that have to be built. The difficulty of managing which configurations to build for which customer becomes increasingly relevant and a solid, flexible build is mandatory to carry the project through this complexity

Porting Java ME applications can be scary, but with a lot of preparation and research, Java ME applications can be successfully ported to multiple devices. Fears about being swamped by the unmanageable number of problems that are encountered in different devices can be silenced. The ME project, which could so easily have ended in failure, can now be tackled with the same confidence that one has undertaking a regular Java project.


  • J2MEUnit - http://j2meunit.sourceforge.net
  • JUnit - www.junit.org
  • J2MEPolish - www.j2mepolish.org
  • J2ME Device DB project - http://j2me-device-db.sourceforge.net
  • More Stories By Hayden Marchant

    Hayden Marchant is a Software Engineer in the Information Integration Solutions group at IBM. He has 10 years of experience in software engineering. Hayden has a 1st class honors BA in mathematics from Cambridge University, England, and is a Sun Certified Programmer.

    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.

    IoT & Smart Cities Stories
    To Really Work for Enterprises, MultiCloud Adoption Requires Far Better and Inclusive Cloud Monitoring and Cost Management … But How? Overwhelmingly, even as enterprises have adopted cloud computing and are expanding to multi-cloud computing, IT leaders remain concerned about how to monitor, manage and control costs across hybrid and multi-cloud deployments. It’s clear that traditional IT monitoring and management approaches, designed after all for on-premises data centers, are falling short in ...
    We are seeing a major migration of enterprises applications to the cloud. As cloud and business use of real time applications accelerate, legacy networks are no longer able to architecturally support cloud adoption and deliver the performance and security required by highly distributed enterprises. These outdated solutions have become more costly and complicated to implement, install, manage, and maintain.SD-WAN offers unlimited capabilities for accessing the benefits of the cloud and Internet. ...
    The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
    The Founder of NostaLab and a member of the Google Health Advisory Board, John is a unique combination of strategic thinker, marketer and entrepreneur. His career was built on the "science of advertising" combining strategy, creativity and marketing for industry-leading results. Combined with his ability to communicate complicated scientific concepts in a way that consumers and scientists alike can appreciate, John is a sought-after speaker for conferences on the forefront of healthcare science,...
    Machine learning has taken residence at our cities' cores and now we can finally have "smart cities." Cities are a collection of buildings made to provide the structure and safety necessary for people to function, create and survive. Buildings are a pool of ever-changing performance data from large automated systems such as heating and cooling to the people that live and work within them. Through machine learning, buildings can optimize performance, reduce costs, and improve occupant comfort by ...
    René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
    Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
    DXWorldEXPO LLC announced today that Ed Featherston has been named the "Tech Chair" of "FinTechEXPO - New York Blockchain Event" of CloudEXPO's 10-Year Anniversary Event which will take place on November 12-13, 2018 in New York City. CloudEXPO | DXWorldEXPO New York will present keynotes, general sessions, and more than 20 blockchain sessions by leading FinTech experts.
    Apps and devices shouldn't stop working when there's limited or no network connectivity. Learn how to bring data stored in a cloud database to the edge of the network (and back again) whenever an Internet connection is available. In his session at 17th Cloud Expo, Ben Perlmutter, a Sales Engineer with IBM Cloudant, demonstrated techniques for replicating cloud databases with devices in order to build offline-first mobile or Internet of Things (IoT) apps that can provide a better, faster user e...
    Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of ...