O'Reilly logo

Programming Wireless Devices with the Java™ 2 Platform, Micro Edition, Second Edition by Jim Holliday - Editor, Aleksi Uotila, Mark Patel, Jyri Huopaniemi, Jim Van Peursem, Antero Taivalsaari, Roger Riggs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

20.3. Application Resource Files

MIDP provides the capability of storing resources in the application's JAR that can be accessed by a MIDlet at run time. An example of such a resource might be a locale bundle, an icon, or a graphical image; however, any thing that can be accessed as an InputStream can also be stored. These resources are accessed using the method getResourceAsStream(String name) of class java.lang.Class.

The rules and the parameter string format for accessing resources inside a JAR file have been discussed in Section 19.1.4, “MIDlet Suite Execution Environment.” As a general rule, if the parameter string to the getResourceAsStream method begins with a '/', the search for the resource begins at the “root” of the JAR file; however, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required