I unzipped 'rt.jar' and updated the ArrayIndexOutOfBoundsException class file to display new message instead of the original... then I replaced the original class file with the new one in 'rt.jar'.... but when I try to execute this class it gives me the message "updated class file executed"... now my question is how does JVM detect that the class file has been updated ,cause I did not change the contract of that class... does it mantain any field similar to 'serialVersionUID' or does it mantain some sort of 'timestamp' ??
The significant problems we face cannot be solved by the same level of thinking which created them – Einstein SCJP 1.5, SCWCD, SCBCD in the making
OK maybe my question is not very clear... My idea was not to replace the message in ArrayIndexOutOfBounds ... my idea was to see if this technique works... ArrayIndexOutOfBounds was just a class i choose by chance and i changed the message cause i that change would not voilate the contract of the class ( in Java sense not legal contract) .... So my question again how does JVM know the class has been changed..??
[ March 17, 2008: Message edited by: abhishek pendkay ] [ March 17, 2008: Message edited by: abhishek pendkay ]
Joined: Oct 13, 2005
Don't know, but it is just as well; you are in breach of your licence agreement altering classes with java. in their package name.
Joined: Oct 30, 2001
In the very rare case that you need to replace Sun's version of a java.* class, there is an approved mechanism. Use the "boot class path" (-Xbootclasspath option to java command).
Changing rt.jar ist verboten.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Joined: Jan 01, 2007
Thanks Peter , but I still dont understand how does JVM detect that the class file has been updated..???
Joined: Mar 22, 2005
It could be using any number of methods - e.g. the modification date of the rt.jar file, or a checksum or hash of its contents. If it does the latter, that would be rather tricky to circumvent.