Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unpack and repack .jar files

Tags:

c#

jar

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#

like image 510
user2579151 Avatar asked Dec 30 '25 17:12

user2579151


2 Answers

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

like image 72
Juned Ahsan Avatar answered Jan 02 '26 15:01

Juned Ahsan


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

like image 33
eldris Avatar answered Jan 02 '26 15:01

eldris