Robin Rodricks
Robin Rodricks

Reputation: 114086

Where does a Java ME JAR install to?

When you install a Java ME program on a phone using a .jar file, where does it install to? At which path can the Java files be found? Or does it install to a location hidden from the filesystem?

Upvotes: 1

Views: 345

Answers (1)

Chris Harcourt
Chris Harcourt

Reputation: 779

The exact location of your application's files will depend on device/platform your running on. As far as I know there is no standard way for an application to get this location.

This is deliberate - there should be no reason for you application to be aware of how/where it is stored (doing so would prevent portability).

If you just want access to other resources stored in your JAR I suggest you look a the getResourceAsStream method of the MIDP Class class (see javadoc). For example:

InputStream is = getClass().getResourceAsStream("somefile.txt");

Or, assuming your target devices support it, there is JSR-75 which provides a File Connection package to allow access to the device's filesystem directly.

Upvotes: 2

Related Questions