Re: How to save a new data file inside the executable JAR package?
JTL.zheng wrote:
How to save a new data file inside the excutable JAR package?
A Jar and a package are very different things. One
jar might contain classes from many packages, while
the classes of one package might also be spread
across a number of Jar files. The latter is uncommon,
and does not make much sense, but it is possible.
if only
-- new File("text.dat")
it will save the file in the folder where the jar file live in.
I want to save the file inside the jar package.
Unpack the jar, then repack it with the new file.
What ability are you attempting to offer to the
end user by doing that?
And assuming I recall your earlier questions correctly,
I will ask you to please try and separate strategies from
goals. Most of the time, the strategy is the entire wrong
way to achieve the goal. It is much easier to help when
we understand the goal.
As an example.
Goal - Offer the user the option to store program
preferences between runs, without cluttering their
disks with a load of files.
Strategy - Put the data in a file and hide it inside the
executable jar.
Note that I can think of a number of ways to achieve
that goal, but *nothing* that justifies that strategy.
So - what is the actual *goal*?
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200709/1