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?
According to your requirement, You can download JDKs of different versions and save them into different folders on different drives.
Or, suppose you are working on multiple projects, some of which use Java 8 and some of which are new projects using Java 11. So, in order to work on both of these projects, you will need to install multiple versions of the JDK on your machine and be able to switch between them.
Yes, you can have multiple JRE installed on the same machine on the same O/S. And you can have one project configured with one version of Java Compiler on your IDE.
If you want to run Java programs, but not develop them, download the JRE. If you want to develop Java applications, download the Java Development Kit, or JDK. The JDK includes the JRE, so you do not have to download both separately.
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)."
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With