Monday, February 4, 2008

Why does JDK install two JREs?

I've never really understood it, and since I've installed Java SE 6.0 Update 4 about five times in the last few days, it's really started to become irksome. When you install a JDK on Windows, it installs one JRE under the JDK directory (e.g. %JAVA_HOME%/jre) and then, having finished installing the JDK runs out and installs another JRE in a different directory.

Why? What's the point behind this? I realize it allows you to uninstall the JDK and leave the JRE intact, but isn't that like having Microsoft install Office as a suite, and then Word, Excel, etc into different directories so that you can uninstall Office without uninstalling Word, Excel and Powerpoint?

It's weird, and silly. Is there a rationale that I'm missing?

4 comments:

technomage said...

The JDK VM includes more debug information than does the JRE VM.

Try throwing an exception under each and examine the difference in the stack traces.

Geoffrey Wiseman said...

Did a simple test, no difference - could you be more specific?

And if that were true, why bother installing the 'consumer' JRE?

Geoffrey Wiseman said...

Ah, yes, the line numbers are available in the stack trace in a slightly more complicated example - the JRE classfiles contain the debug information. Well, that at least explains that there's a difference, although i'm still not sure why I'd want both JREs.

Anonymous said...

There's probably an impact on performance.