Why's a simple change to rt.jar causing the Java Runtime Environment to crash silently?

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-03-13T21:12:48Z Indexed on 2010/03/13 21:15 UTC
Read the original article Hit count: 225

This is what I'm doing:

  1. extract contents of my JRE's rt.jar
  2. extract src.zip of my JDK (same version)

Now, if I copy Runtime.java from the extracted src folder and compile it using javac.exe without any modifications and then put it in the extracted rt folder to finally put everything back in a jar file using jar.exe, everything works as expected. The JRE runs fine.

However, if I make the slightest change to Runtime.java and compile it and put it in rt.jar, the JRE crashes whenever I attempt to start it. This is an example of a slight change that causes the silent crash:

/** Don't let anyone else instantiate this class */
    private Runtime() {
        System.out.println("This is a test.");
    }

Instead of:

/** Don't let anyone else instantiate this class */
    private Runtime() {}

Could anyone tell me why this is causing my JRE to crash?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about jre