3

I want to unpack a .jar file, add files to it, and finally repack it again.

I'm not familiar with .jar archive handling

Could you give some help as to how to do this?

I'm want to do this in c#

andrewsi
  • 10,807
  • 132
  • 35
  • 51
user2579151
  • 55
  • 2
  • 7
  • 1
    Note that jar files are basically zip files with a few special files in them. So any library that lets you work with zips will also let you work with jars. – Viktor Seifert Jul 17 '13 at 14:39

2 Answers2

4

If you know how to run commands in c# then you can use the following jar commands

to package a jar

jar -cf yourjarname.jar contentsdir

to unpackage a jar

jar -xf yourjarname.jar

To understand how to run commands using c#, this post should help you:

Run Command Prompt Commands

Community
  • 1
  • 1
Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
1

If you don't want to execute native commands, this could be an interesting read: Opening Jars With C#

eldris
  • 205
  • 1
  • 5