Where are you in your project? What does the posted code do?
Does it give errors when executed?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
So the "my jar" is the R/O source and the "other jar" is the one being changed.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
I compiled and executed the code and got no exceptions.
I started with a jar file and a text file.
I end up with three files: a new jar file containing the old jar file's contents plus the text file, a backup of the old jar file and the text file.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Since you are copying all the files from one jar to the other, skip copying those you do not want to be in the output jar.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Please explain.
Your code currently gets all the files in my jar.
Pseudo code
begin loop
get my jar entry
if (to skip this one) continue; // skip copying this entry to other jar
write this entry to other jar
end loop
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
How would I get the jar though
Your program has it hard coded.
Why not use the JFileChooser to "get" the name and path to the my jar.
I know how to find the other jar
Now this is confusing. Earlier I asked about the jars being used.
There were two, my jar and the other jar.
The other jar was created by copying from my jar and adding a file.
Is there now a third jar?
Also, how do I tell if an entry is what I want to copy over
This is really a hard one to answer. What determines what files you want to copy?
That is an question I can not answer. You have to provide that.
Is there a way to detect if it's in a folder?
Where is this folder? In the my jar?
You need to read the API doc for the zip file classes to see what information is available about the contents of a zip file
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Why copy a file if you are going to delete it?
Don't copy it.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
I understood that there are two jar files being being used. The 'my' was R/O, the 'other' jar was a copy of the 'my' jar. When you copy from the 'my' jar to the 'other'jar do NOT copy the files you do not want in the 'other' jar.
If you don't copy the files, you will not have to delete them.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16