I have a Jar file which contains multiples .class files. I want to update one of the .class file with a new one, I used the command:
jar uf jar-file input-file(s)
My problem is that others classes use some functions defined in the updated class file and after updating it seems that I can't call any method of the updated class. Please have a look on my example below:
class1.java:
package com.package1;
class1
{
void method1()
{
System.out.println("In method1");
}
}
class2.java:
package com.package2;
import com.package1.class1;
class2
{
void method2()
{
class1 cl1 = new class1();
cl1.method1(); //<<<<<< This line doesn't work after updating class1, program exits.
}
}
- MyJar.jar:
class1.class
class2.class
Do I need to recompile all classes of the jar?
Will work on OS having drag-n-drop feature.
If you have 7-zip software installed (or maybe any archive viewer), then
open the jar file with 7-zip -> navigate to the package -> drag and drop the .class file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.