I have see two jre in the java folder one in jdk and one outside jdk. Can you tell me the what is the reason behind having these two jre?
I didn't read your answer right and searched a little, here's an answer from somebody who seems to be Oracle staff:
There are some differences which may explain what you are seeing. The JRE that is included with the JDK does not support Auto Update and it does not contain any product offerings as the standalone JRE does. The JRE and JDK are both built at the same time (approximately) from the source base.
from https://forums.oracle.com/forums/thread.jspa?threadID=2277801
Old Answer 32/64 Bit Windows
If you are on Windows 7 64 Bit (or maybe other MS 64 Bit Systems) you need 2 JRE's. One for your 64 Bit Applications (Browser) and one for 32 Bit. They should have distinct Folder Names, ie: 64 Bit C:\Program Files\java\jre7 32 Bit C:\Program Files (x86)\java\jre7
If you're just running an application you only need the Java Runtime Environment (JRE), so it make sense to deliver that as a distinct entity.
If you are developing the you need the complete Java Development Kit, and it's helpful to have everything you need including the JRE.
So, two usage scenarios, two ways to get the JRE.
See the question referenced by Jaya for more information.
If you are developing a java program then compile time private jre
(C:\Program Files\Java\jdk1.7.0_65\jre) will be used and running time public jre
(C:\Program Files\Java\jre7) will be used.This is the default use case scenario.If compile time jvm finds that private
jre is not there then it will go for public
jre and run time also if jvm finds that if public
jre is not there then it will go for private
jre.
The JDK is required for developing Java applications, but it includes a JRE (Java Runtime Environment) which is required in order to run Java applications.
If you're an advanced user and you know what you're doing then you only need one copy of the JRE, meaning that you do not need the "Public JRE" in addition to the one that comes with the JDK.
Simply set your Environment variable JAVA_HOME
to point to the JDK installation directory, and add the JRE's bin
directory, i.e. %JAVA_HOME%\jre\bin
, to your PATH
.
If you want Java to notify/remind/annoy you about updates, and have an extra 200MB of disk space that you don't need, then install the public JRE too.