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?
+2
A:
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.
Chris Harcourt
2009-09-11 18:41:47