# [java] PAK files in J2ME

This topic is 4514 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi All, I am a new Joinee of this forum...........i have just started working on J2ME game development...........Could you plz tell me how to read n edit the contents of PAK files which are kept in /res folder of a project...... thanks, ramy

##### Share on other sites
J2ME questions are normally better suited to the "Consoles, PDAs and Cell Phones" forum.

Anyway, in your compiled jar there will not actually be a /res folder (assuming a normal setup, like building through the WTK or NetBeans or something). So the file is at the top directory of the jar, and you just open an InputStream for it:

InputStream is = this.getClass().getResourceAsStream("/mypak.pak");// You can use any Class object for the getResourceAsStream object;// in case you have to call this from a static method, you could do// e.g. new Object().getClass(), or currentClass.class .// If you're using packages, and there is no leading slash in the filename,// the path will be relative to whereever the specified class is in the JAR.

From there, use the InputStream's methods - read the docs.