Hello Guest

Need Help With Java Filesystem and GetDown Please

  • 5 Replies
  • 8650 Views
*

Offline dangerdoc

  • **
  • 75
  • Thats right... Nikola Tesla
Need Help With Java Filesystem and GetDown Please
« on: February 22, 2012, 16:24:46 »
In lwjgl, I am programming a game for pc. I am using GetDown to manage the data. How do I put the files in appdata using GetDown? Does Java Filesystem work in relation to the .jar using it? For instance, if I have a jar at C:/program files/java.jar, specifying images/image.jpeg will point to C:/program files/images/image.jpeg?
Can you also use ../image.jpeg to get C:/image.jpeg? Is there a path to specify for appdata, like %appdata%?

Please help me!

*

Offline kappa

  • *****
  • 1319
Re: Need Help With Java Filesystem and GetDown Please
« Reply #1 on: February 22, 2012, 16:36:22 »
You need to put your images inside a jar file (they are just zip files), and then load it from Java using an InputStream instead of a FileSystem File. Basically the same as you do when using an Applet or Java Web Start.
« Last Edit: February 22, 2012, 16:39:03 by kappa »

*

Offline dangerdoc

  • **
  • 75
  • Thats right... Nikola Tesla
Re: Need Help With Java Filesystem and GetDown Please
« Reply #2 on: April 01, 2012, 23:32:24 »
My question was really an abstract question about managing files outside the jar that need to be changes frequently (example, save files?) About GetDown, How does it know where to put the files for each OS? After it installs the files, how do you tell the app it's location in the FS? Can you specify "../" to get to the .jar's parent folder? Also, I don't understand how you make a program that uses getdown to download/install/update an app. I read the wiki, and OOO labs, but I didn't get it. Could you just tell me how to make a small program that downloads, installs, and launches my app?

Thanks,
dangerdoc

*

Offline dangerdoc

  • **
  • 75
  • Thats right... Nikola Tesla
Re: Need Help With Java Filesystem and GetDown Please
« Reply #3 on: April 28, 2012, 00:26:53 »
Let me narrow down the question since nobody answered yet. If I have a .jar somewhere in the computer, how do you access files without knowing the .jar's directory? This may be a simple question, but I don't know much about java file management.

Thanks,
dangerdoc

*

Offline kappa

  • *****
  • 1319
Re: Need Help With Java Filesystem and GetDown Please
« Reply #4 on: April 28, 2012, 10:30:50 »
GetDown will automatically add the jar to the java classpath, so all you need to do is call an inputstream to the file in the jar that you want to get.

*

Offline dangerdoc

  • **
  • 75
  • Thats right... Nikola Tesla
Re: Need Help With Java Filesystem and GetDown Please
« Reply #5 on: May 16, 2012, 16:31:31 »
Is there a way to put files into the .jar while it is running? I really wanted to know how to access saved games while the program is running.