Accessing resources

Resources can be accessed using absolute or relative paths - getResourceAsStream method uses more strict rules for accessing resources with relative paths than in previous release (to be inline with MIDP 2.1 specification).

Relative pathnames are relative to the class upon which getResourceAsStream is called. Relative names are converted to absolute by prepending a fully qualified package path.

For example, assuming MIDlet has JAR directory structure illustrated below then getResourceAsStream(“bar.txt”) succeeds but getResourceAsStream(“foo.txt”) fails.

Previously it was possible access foo.txt using relative path also.

Absolute path, getResourceAsStream(“/foo.txt”), should be used to access foo.txt.