5

I have class called org.jbpm.task.Comment in my jbpm.jar.

However, this it's a CR1 version and there is a bug in the class that I would like my application to overwrite.

Is it fine just to have a class in my project under com.jbpm.task called Comment and everywhere even in other jars it will refer to mine?

Dejell
  • 13,947
  • 40
  • 146
  • 229

4 Answers4

7

JAR files are just ZIP files. Use a tool like WinZip to extract all the files from the JAR, replace the .class file with yours, recreate the ZIP file using e.g. WinZip, rename it to .jar, overwrite the original JAR file.

If you don't have the original source to the .class file you need to correct, then use a Java decompiler to produce .java source for the class. It will lack comments etc present in the original, but it will be sufficient to correct errors (e.g. incorrect null checking, as I had a few times in some products.)

Adrian Smith
  • 17,236
  • 11
  • 71
  • 93
2

I would suggest using a Zip utility like 7zip to open the jar file and replace the class in the jar file the the latest one.

Paul
  • 4,812
  • 3
  • 27
  • 38
1

Well the behavior is not guaranteed. Sometime back I had a bad experience because of that. Check out the below SO thread. If you are targeting differnt JVM implementation then it could be a problem.

Xerces behaving differently on SUN JRE v1.5 and IBM J9 v1.5

Community
  • 1
  • 1
Favonius
  • 13,959
  • 3
  • 55
  • 95
0

You would have to make sure that your jar is loaded before bpm.jar. In some JREs jars are in the same location are loaded in alphabetic order.

adrianboimvaser
  • 2,651
  • 1
  • 22
  • 30