Is it safe to replace single class file in a jar file?

executable-jar, jar, java, patch

Solution

Yes, you can run `jar uf mJarFile.jar com\example\mClass.class`.

However, be aware that if the class defined constant `static final` primitive or String variables, then those values will have been in-lined into other classes (and so the values contained in your newer class won't be used).

Problem

Is it safe to replace a single class file in a jar file? Do the class files reference each other in such a way that this is not safe? Grae

Original source

Related problems