Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between bin's java.exe and JRE's 'java.exe'

Tags:

java

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?

like image 653
anshul Avatar asked Aug 04 '11 05:08

anshul


People also ask

What is Jre EXE?

<jre>.exe is the single executable installer for the Java Runtime Environment (JRE)

What is the path to java EXE?

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.

Where is java EXE in JDK?

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 .

How do I find my java executable?

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.


2 Answers

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 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).

So I think you should use executables from the /bin directory when executing Java programs.

like image 116
Peter Molnar Avatar answered Sep 19 '22 17:09

Peter Molnar


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.

like image 43
Abimaran Kugathasan Avatar answered Sep 21 '22 17:09

Abimaran Kugathasan