Jump to content
  • Advertisement
Sign in to follow this  
GekkoCube

Is it possible for a J2ME application to open another jar file?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Suppose you download a game (which is a .jar file). Is it possible to download a second jar file which has only additional assets so that the jar #1 (the application/game) could read files from jar #2 ?

Share this post


Link to post
Share on other sites
Advertisement
You can download additional assets (assuming you have security permissions to do so; probably the phone will prompt the user to allow the connection, or something), for example by HTTP. Check the MIDP javadoc for class Connector, and interface Connection. (And look at Sun's tutorials too, with those keywords). However, you probably want to leave those resources as whatever plain files, rather than a JAR - because what you're going to receive is an InputStream (or you can send an OutputStream, for that matter), and you have to handle the decoding of input yourself. Some library widgets can make effective use of an InputStream (IIRC in MIDP 2.0 you can use it as a parameter for Image.createImage()), but in general you are stuck doing the hard work yourself. Of course, if your "resource" is a level file for your game or something, then you had to interpret it anyway, so it's the same thing :) You just get your InputStream from a Connection, instead of Class.getResourceAsStream().

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!