Question

Before downvoting or close-requesting this question please see that this question is about JDK 7 not 6, it has a second question 'Q2' which is not addressed by any duplicate thread and this question is about four not only two java.exe instances. Thank you!


I've just installed Oracle's Java SE JDK (64 bit) which resulted in the following directory layout, and somehow two JREs:

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

I'm now the proud owner of four java.exe executables:

C:\Program Files\Java\jdk1.7.0_40\bin\java.exe
C:\Program Files\Java\jdk1.7.0_40\jre\bin\java.exe
C:\Program Files\Java\jre7\bin\java.exe
C:\Windows\System32\java.exe

Q1: Which one should I put into my search path to execute Java-based applications?

Q2: Do I need to put the Unlimited JCE Policy files just into the security sub-directory of the corresponding JRE in my search path or also into all others in order to work correctly?

Était-ce utile?

La solution

While installing JDK you will have a copy of JRE installed automatically. You need not install a copy of JRE separately. yet this will be your directory structure.

The copy of JRE in the JDK folder is for the is a private copy of JRE.

Installing the JDK installs a private Java SE Runtime Environment (JRE) and optionally a public copy. The private JRE is required to run the tools included with the JDK. It has no registry settings and is contained entirely in a jre directory (typically at C:\Program Files\jdk1.6.0\jre) whose location is known only to the JDK. On the other hand, the public JRE can be used by other Java applications, is contained outside the JDK (typically at C:\Program Files\Java\jre1.6.0), is registered with the Windows registry (at HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft), can be removed using Add/Remove Programs, might or might not be registered with browsers, and might or might not have java.exe copied to the Windows system directory (making it the default system Java platform or not)."

Autres conseils

Which one should I put into my search path to execute Java-based applications?

According to the "JDK and JRE File Structure" document, you should add jdk1.7.0\bin to the path:

c:\jdk1.7.0\bin Executable files for the development tools contained in the Java Development Kit. The PATH environment variable should contain an entry for this directory. For more information on the tools, see the JDK Tools.


Do I need to put the Unlimited JCE Policy files just into the security sub-directory of the corresponding JRE in my search path or also into all others in order to work correctly?

According to the "Unlimited Strength Java(TM) Cryptography Extension Policy Files" documentation you will need to install the unlimited strength policy JAR files for all JREs that you plan to use.:

On Windows, for each JDK installation, there may be additional JREs installed under the "Program Files" directory. Please make sure that you install the unlimited strength policy JAR files for all JREs that you plan to use.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top