Results 1 to 5 of 5
Thread: Write to a file in a jar
- 06-11-2009, 09:26 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 85
- Rep Power
- 0
Write to a file in a jar
Hi
I am creating an application.In order to run the application i have to create jar files,which i do with the help of eclipse.I am developing the appl using eclipse.
I know how to write to a file using eclipse
above code would create a file in the src folder with filename.ext specified.Java Code:FileOutputStream fos=new FileOutputStream("src/filename.ext"); myop=new PrintStream(fos);
But what i want to know is how do i create and write to a file in a jar file..
Hope I am explaning it clearly..
any help would be appreciated.
Thanks
-
In general, I think that the answer is, "you don't". For one, jars don't hold files but resources, or for a second, I believe that they're not in general supposed to be altered -- but there could be exceptions.
- 06-12-2009, 10:02 AM #3
To make a jar using eclipse, select "Export" when right-clicking on your project.
To make a jar using Java, first consider if it's necessary as Fubarable says, and if so use the java.util.jar package.Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 06-12-2009, 04:58 PM #4
Member
- Join Date
- Jun 2008
- Posts
- 85
- Rep Power
- 0
I create jar files using eclipse export and have my jar files in such a way that the resources folder have files from which the application reads and does jobs...if reading can be done,is it not possible to write files to the resources folder of the jar??
i am sorry if i didnt get what you were trying to tell..but can you plz explain me more clearly...
-
The general rule is that you can't do what you are trying to do. If you feel you must, then you're program will have to un-jar the jar file, find the text file, change it, and then re-jar the jar file. I don't think that it's worth this trouble. I suggest you look for some other way to do what you want that does not involve attempting to write to a file held within a Jar file.
Similar Threads
-
how to write onto a file
By mirage_87 in forum New To JavaReplies: 6Last Post: 09-08-2009, 03:54 PM -
How to read and write to a file without taking out the comments in the file
By MAGNUM in forum New To JavaReplies: 5Last Post: 02-05-2009, 10:28 AM -
[SOLVED] File Write in File
By Eku in forum New To JavaReplies: 4Last Post: 10-27-2008, 04:01 AM -
write nio.CharBuffer to file
By Beju in forum New To JavaReplies: 5Last Post: 10-19-2008, 08:20 PM -
Write to file
By esadeghi in forum Advanced JavaReplies: 1Last Post: 05-21-2008, 01:13 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks