简体   繁体   中英

Why Java installs a JRE when a JDK is being installed

When I install the Oracle Java JDK, it also installs separately a JRE. Like so:

JDK:

C:\Program Files\Java\jdk1.7.0_40

JRE:

C:\Program Files\Java\jre7

Isn't the JRE a subset of the JDK? Why would I need the JRE executables and libs twice?

In particular, is there a difference between the java.exe in the JRE/bin and the one in the JDK/bin ?

I believe adding JDK/bin to the path should suffice.

I'm on Win 7 (in case that's relevant).

The JDKs are versioned and have their own directories, the jre directory just gets the latest version of Java (so if you only updated, you see it install repeatedly) and is shared. It is for all the released applications to run.

If you install once, there is no difference, but if you need a specific version, you can't use the jre

Java Runtime Environment ( JRE ) contains the JVM where your Java programs run on. You need this to run anything that requires JVM.

Java Development Kit ( JDK ) includes the software development kit along with JRE. Sometimes even you are not planning to develop anything, you still need it.

There's no difference unless the version in your JDK is different from the version in your separate JRE directory.

This answer has some detail explanation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM