aspose file tools*
The moose likes I/O and Streams and the fly likes writing to jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "writing to jar file" Watch "writing to jar file" New topic
Author

writing to jar file

Joe McIntyre
Ranch Hand

Joined: Nov 20, 2003
Posts: 121
I'm developing a desktop app in NetBeans. Currently, when I run the program from within the NetBeans environment, it uses (I think) the build folder, which does not have everything packaged in a jar file. So I can write to any of those folders that correspond to package names in my application. But what will happen when I package the whole thing in a jar file for deployment? I can't write to a file that is stored in that jar file can I? Is there a standard solution for this problem?

Thanks.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

Originally posted by Wally Flint:
I can't write to a file that is stored in that jar file can I?

No.

Originally posted by Wally Flint:

Is there a standard solution for this problem?

That depends on what you are trying to do.


[How To Ask Questions On JavaRanch]
Joe McIntyre
Ranch Hand

Joined: Nov 20, 2003
Posts: 121
Well, suppose I just want to save some application preferences... what would I do then?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

A good place to do that is in the user home directory.
You can get that through the java.lang.System.getProperties() method.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42934
    
  68
That sounds like a case for the Preferences API.
Joe McIntyre
Ranch Hand

Joined: Nov 20, 2003
Posts: 121
Thanks guys!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: writing to jar file