How to add a class to a .jar file

Posted on 2011-02-17
Last Modified: 2012-05-11
I have a Java program that has many .jar files.  I recently received two class files that need to be added to one of the .jar files.   How can I add these to a jar file?
Question by:jbaird123
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1

Expert Comment

ID: 34920287
Here is this explanation of it though. It goes into much more detail.
LVL 92

Expert Comment

ID: 34920719
jar uf <class file name> <jar file name>

Make sure you include the class in its package/folder structure
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

LVL 92

Expert Comment

ID: 34920727
oops, wrong way around. should be:

jar uf <jar file name> <class file name>

Accepted Solution

calboronster earned 500 total points
ID: 34924945
To make it very very simple..

rename the file to .zip
open and extract with winzip or any zip software (a folder structure will be extracted)
copy your file in the required folder location
zip the folder back to the same name as your jar and you are done.

Remember the folder structure after zipping should be exactly the same as before for things to work.

Author Closing Comment

ID: 34960609
Thank you.

Expert Comment

ID: 34960642
Thank you jbaird for the grade and the points.
Have a nice day.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question