oliverUK
asked on
Updating a Jar File
I am having a problem creating a jar file
1)I successfully archived my classes in by :-
jar uf myFile.jar *.class
2)I successfully updated my manifest to specify entry point by:-
jar cmf myManifestFile myFile.jar *.class
3) I want to archive an images directory into the jar that my application uses- here is my problem!
I try "jar uf myfile.jar images"
but I keep getting back
java.io.IOException: Error in writing existing jar file
at sun.tools.jar.Main.run(Mai n.java:177 )
at sun.tools.jar.Main.main(Ma in.java:90 3)
What am I doing wrong?
Thanks
1)I successfully archived my classes in by :-
jar uf myFile.jar *.class
2)I successfully updated my manifest to specify entry point by:-
jar cmf myManifestFile myFile.jar *.class
3) I want to archive an images directory into the jar that my application uses- here is my problem!
I try "jar uf myfile.jar images"
but I keep getting back
java.io.IOException: Error in writing existing jar file
at sun.tools.jar.Main.run(Mai
at sun.tools.jar.Main.main(Ma
What am I doing wrong?
Thanks
replace "MyImage.gif" by one of yours of course
ASKER
I have already tried that, I get the same error.
Also you can archive directories :-
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/jar.html
Also you can archive directories :-
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/jar.html
Then it seems as your original jar file can't be found or overwritten
Just add only the folder and see that all the images inside the folder are added.
jar cv0f Images.jar Images ------> 0f means no compression for the Images
jar uvf classes.jar *.class -C mydir/mysubdir/yimages
After Adding your Images to your Jar file then in your Java program you must use
ImageIcon img = new ImageIcon(this.getClass(). getResourc e("Images\ YourImage. gif");
to see the Icon.
ImageIcon img = new ImageIcon(this.getClass().
to see the Icon.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
oliverUK,
The link I gave in my first comment was a specific link of a whole Lesson: "Using JAR Files: The Basics."
ashok's comment is just a copy/paste out of another part of that lesson.
I would have expected a split.
The link I gave in my first comment was a specific link of a whole Lesson: "Using JAR Files: The Basics."
ashok's comment is just a copy/paste out of another part of that lesson.
I would have expected a split.
Thanks for accpeting
:-)
zzynx is right
:-)
zzynx is right
Thanks ashok.
If you want this question to be reopened, post a zero-point question in https://www.experts-exchange.com/Community_Support/
Subject: Moderator Please Reopen
Body: Please reopen this question:
https://www.experts-exchange.com/questions/21343414/Updating-a-Jar-File.html
Once reopened, you can perform a split.
If you want this question to be reopened, post a zero-point question in https://www.experts-exchange.com/Community_Support/
Subject: Moderator Please Reopen
Body: Please reopen this question:
https://www.experts-exchange.com/questions/21343414/Updating-a-Jar-File.html
Once reopened, you can perform a split.
ASKER
Yes splitting points is fair, apologies zzynx and thank you both for your input.
Regards
OliverUK
Regards
OliverUK
>> Yes splitting points is fair
Thanks
Thanks
I think you can't pass a directory.
does
jar uf myfile.jar images/MyImage.gif
work?