Sign in to follow this  
simply_bindaas

[java] PAK files in J2ME

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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this