Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diference between jdk/bin/java and jdk/jre/bin/java

Tags:

java

jvm

Making somes tests this week i found this situation:

When i run the tomcat using the java executable in jdk/jre/bin/java the performance is a lot betther than when i run with jdk/bin/java. The question is: Someone knows why the jdk package delivers 2 java executables and what is the difference between them that justifies the performance difference?

like image 926
Thiago Lacerda Avatar asked Oct 31 '13 15:10

Thiago Lacerda


2 Answers

I'm late to the party, but... I came here looking for the difference between the several java variants within OpenJDK. I only ended up with a few clarifications and additional questions to the "what's the difference between them" part of the question; hope it's helpful.

Looking inside the OpenJDK (I'm using OpenJDK 1.7.0) base directory I see three javas, all with different hash-sums:

  • bin/java, binary
  • jre-abrt/bin/java, binary; assuming ABRT is Automatic Bug Reporting Tool
  • jre/bin/java, a shell script that execs the jre-abrt/bin/java variant, in one of two different ways (more below).

The binary variants above have the same file-size and creation-time (in my version and system, anyway) but 4 bytes differ between the two files (I haven't looked much further -- this is the other part of your question -- but they are different, and it doesn't look like an ASCII string, for instance).

The script variant is the one you're saying is faster, which seems counterintuitive because it seems to be doing more. (Or perhaps you're only seeing the time to execute the script and not the exec'd java command?). The script checks to see if an ABRT shared-object file exists, and if so it passes (as -agentpath...) the .so and abrt=on. Again, this seems like it should be nothing but more work... assuming use of ABRT.

If you're still interested in this topic, perhaps it would be interesting to see the following:

  • what path in that script you're taking (check for existence of /usr/lib64/libabrt-java-connector.so or whatever is in your jre/bin/java script)
  • if directly executing the third variant (jre-abrt/bin/java) is faster
  • what else is being touched in both of these cases -- like inotify or strace or something, but this is probably enormous for a service like this.
like image 103
hoc_age Avatar answered Oct 23 '22 03:10

hoc_age


the java.exe files are actually the same. The JDK is the Java Development Kit, which includes all of the java executables you need to develop applications.

The JRE is the Java Runtime Environment, which includes what you need to run Java applications

So for running the application in a deployed mode, you would need only the JRE, as end users are likely to have only a JRE and not a JDK.

like image 26
Thirumalai Parthasarathi Avatar answered Oct 23 '22 01:10

Thirumalai Parthasarathi