Solved

How to add a class to a .jar file

Posted on 2011-02-17
7
1,056 Views
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?
0
Comment
Question by:jbaird123
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34920277
0
 
LVL 9

Expert Comment

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

http://www.lkn.ei.tum.de/arbeiten/faq/man/JAVA-tutorial/jar/basics/update.html
0
 
LVL 92

Expert Comment

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

Make sure you include the class in its package/folder structure
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Expert Comment

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


jar uf <jar file name> <class file name>
0
 
LVL 2

Accepted Solution

by:
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.
0
 

Author Closing Comment

by:jbaird123
ID: 34960609
Thank you.
0
 
LVL 2

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Free Alternative to JIRA 4 91
how to add new optional parameter to JSP 1 29
MySqlDump not dumping triggers 1 18
Configure a Bean in an XML file 4 13
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

896 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now