13

After downloading the Oracle JDK and unzipping it, I can see that there exists two "java" executables in two different directories.

Which one should be used as primary basis. Or, both are the same in two different locations?

TheManish
  • 163
  • 2
  • 9

1 Answers1

14

The contents of jdk/bin/ is the Java that's included with the Java Developers Kit. The Java inside of jdk/jre/bin would be the Java Runtime Environment's Java.

If you have the JDK packaged version of Java then use the one in jdk/bin/.

But they're the same

If you look at the executables there is actually no difference in them, so it really doesn't matter.

$ pwd
/usr/java/jdk1.7.0_45

$ ll jre/bin/java
-rwxr-xr-x. 1 root root 7718 Oct  8  2013 jre/bin/java
[saml@greeneggs jdk1.7.0_45]$ ls -l bin/java
-rwxr-xr-x. 1 root root 7718 Oct  8  2013 bin/java

$ cmp jre/bin/java bin/java
$
slm
  • 363,520
  • 117
  • 767
  • 871
  • Okay! so I wonder why they provide two similar things. What I did was, just unpacked the jdk package. I hope the one that is inside jdk/bin works smooth on all required stages of JRE. Am I right? – TheManish Jun 09 '14 at 01:47
  • 4
    @ManishShrestha - given the name of the directory it's in, that would be my expectation as well. They provide the JRE by itself so you can just run apps. The JDK is to develop apps. As to why the JRE is bundled inside of JDK, you'd have to ask Oracle. – slm Jun 09 '14 at 01:48
  • 1
    Thanks for noticing that mate. I will try asking Oracle at some free time. :) – TheManish Jun 09 '14 at 01:50
  • This still does not answer the question properly. What's the purpose of the `java` executable in jdk/bin, since basically we need a complete JRE to run our apps? For sure, Oracle needs to provide an answer here. – wget May 28 '17 at 15:23