I am new to Java. I have a confusion which interpreter is used to execute Java programs as I can see two java.exe, one inside the bin folder and the other inside JRE's bin folder.
I want to add some details to clear my query:
Suppose Java is installed in C:\Program Files\Java\Jdk1.6. Now, in this directory there is the jre folder, bin folder, and other folders as well, but let’s concentrate on these two. This ..\jre\bin folder contains java.exe and the ..\bin folder also contains java.exe. So, my concern is: Which Java interpreter is used to execute Java programs?
<jre>.exe is the single executable installer for the Java Runtime Environment (JRE)
The java.exe Executables Two copies of the java.exe executable are installed. One copy is in the bin directory of the Java RE. The second copy is placed in either C:\windows\system or C:\winnt\system32 , depending on the system.
C:\Program Files\Java\jdk1. 6.0 is the location of the development environment. It contains in its bin folder both javac (to compile your code) and java (to run your code) -- arguably you may want to run the code you are developing. That java executable is indeed the same as the one in the jre .
You need to find the Java executable file (java.exe file) on your computer hard drive. It is often located in the "Program Files\Java" or "Program Files (x86)\Java" folder, within a possible subfolder below the Java folder. Once you find the file, select it and click OK.
From the Java SE installation notes:
http://www.oracle.com/technetwork/java/javase/documentation/install-windows-142126.html#private
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 atC:\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).
So I think you should use executables from the /bin directory when executing Java programs.
JRE: Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on. It also includes browser plugins for Applet execution.
JDK: It's the full featured Software Development Kit for Java, including JRE, and the compilers and tools (like JavaDoc, and Java Debugger) to create and compile programs.
Usually, when you only care about running Java programs on your browser or computer you will only install JRE. It's all you need. On the other hand, if you are planning to do some Java programming, you will also need JDK.
Sometimes, even though you are not planning to do any Java Development on a computer, you still need the JDK installed. For example, if you are deploying a WebApp with JSP, you are technically just running Java Programs inside the application server. Why would you need JDK then? Because application server will convert JSP into Servlets and use JDK to compile the servlets. I am sure there might be more examples.
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