• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How do you update a file in a sub-directory inside a .jar file?  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone tell me how to update a file inside a sub-directory that's inside a .jar file?

If I do this, to insert a file and directory that didn't exist, it works:



That inserts a directory I created called "test" containing a file called "test.jsp", inside the jar file: org.eclipse.help.webapp_3.5.2.r36_r20100816.jar

If however I do the same to update an existing file, it does nothing. A directory named "advanced" exists inside the .jar file, and inside of it is a file called "help.jsp" that I want to update. If I do this however:



nothing happens. It looks like it's working, I get no error, but the file is not updated. I have the modified advanced/help.jsp in the expanded directory, it's in the right place, and so on.

I know that the update command works to overwrite/update existing files if they're on the first level, if I do it without the directory change, it works. I also know that I've got the command right for the input, and that you can insert folders as well as files, since the test/test.jsp worked.

Can someone explain how this works?

I see instructions about using -C to change directories for the input side, but nothing about having to change directories in the .jar file that I'm updating. I don't seem to need any change directory command for the input, since as I say the example above using test/test.jsp works fine.

Is it something about trying to replace existing directories inside the .jar file...?

"advanced" has other files inside of it but I only want to replace the one called "help.jsp".

However, I also tried just replacing the entire directory:



but that did nothing either.


Thanks,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!