Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7821413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:38:37+00:00 2026-06-02T07:38:37+00:00

I want to generate programtically a jar file in java. This works well when

  • 0

I want to generate programtically a jar file in java. This works well when the input jar file has NOT been obfuscated. When I use an obfuscator on it, the first entry is no longer the manifest, so I can’t generate a new file…

Here is my code:

JarInputStream input = new JarInputStream(getClass().getResourceAsStream("/obfuscated_jar.jar"));
JarOutputStream output = new JarOutputStream(new FileOutputStream("generated_jar.jar"), input.getManifest());

The line input.getManifest() returns null because the manifest is not at the first place.

I’ve made some searches on it, and it looks to be a known issue with JarInputStream. So here is my question: Is it possible to solve it? Like writing my own getManifest method or something?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:38:38+00:00Added an answer on June 2, 2026 at 7:38 am

    Finally, I found a way to make it.

    I saved my file MANIFEST.MF into my main jar and used that code to replace the input.getManifest()

    Manifest mf = new Manifest();
    mf.read(getClass().getResourceAsStream("/lib/manifest.mf"));
    

    In this case, I extracted the manifest.mf from obfuscated_jar.jar and paste it into the lib folder of my main jar file.

    That’s probably not the best way but it works!

    I hope this could help someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to generate a thumbnail preview of videos in Java. I'm mostly JMF
I want to generate a PDF file on server side, and then in response
I want to insert new entities programatically as well as manually. For this I
Has anyone tried exporting data to Numbers in iWork? I want to generate a
Note: I do NOT want to read audio file foo.bar and play it. I
How do I do if I want to programatically generate a set of buttons
Let's say I have a class of 30 students and want generate every possible
I want to generate a random number with in two range, and i want
I want to generate following xml output in my C# code : <?xml version=1.0
I want to generate some XML in a stored procedure based on data in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.