aspose file tools*
The moose likes Beginning Java and the fly likes Duplicate files in JRE and JDK folders Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Duplicate files in JRE and JDK folders" Watch "Duplicate files in JRE and JDK folders" New topic
Author

Duplicate files in JRE and JDK folders

Rajdeep Biswas
Ranch Hand

Joined: Mar 26, 2012
Posts: 186

Hello all. This post is in the context of the subject of thread.
The JDK vs JRE differences are understandable, but just to have more insight, one query.

In JDK, we have "bin" as well as "jre" directories. Now if "jre" was given for running the programs, then why does "bin" directory inside JDK has java.exe, and other duplicate exe files?

Thanks and regards,
Raj


The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
As you said, the JDK includes a JRE.
Let’s look at my Java installation folder
[campbell@computer jdk1.7.0_09]$ ls
bin lib src.zip COPYRIGHT LICENSE THIRDPARTYLICENSEREADME-JAVAFX.txt db man THIRDPARTYLICENSEREADME.txt include README.html jre release
Now, inside the jre folder, we find this
[campbell@computer jre]$ ls
bin lib plugin THIRDPARTYLICENSEREADME-JAVAFX.txt Welcome.html COPYRIGHT LICENSE README THIRDPARTYLICENSEREADME.txt
and this is the contents of that jre/bin folder.
[campbell@computer bin]$ ls
ControlPanel java_vm jcontrol orbd policytool rmiregistry tnameserv java javaws keytool pack200 rmid servertool unpack200
You see the applications required to run Java programs are there, viz java and javaws. If you want anything for developing programs, like javac, you have to go to the first bin folder
[campbell@computer bin]$ cd ../../bin
[campbell@computer bin]$ ls
appletviewer javac jconsole jsadebugd pack200 tnameserv apt javadoc jcontrol jstack policytool unpack200 ControlPanel javafxpackager jdb jstat rmic wsgen extcheck javah jhat jstatd rmid wsimport idlj javap jinfo jvisualvm rmiregistry xjc jar java-rmi.cgi jmap keytool schemagen jarsigner javaws jps native2ascii serialver java jcmd jrunscript orbd servertool
That means you can install a JRE and only have the jre contents, or a jdk and have both bin folders. You can also set your PATH to choose with instance of the java tool to use.
On a Windows® box, you would have the same contents, but they would have extensions, so it’s java.exe rather than java.
How do you know they are actually duplicate files, rather than links from one file to another? In my case, they probably are duplicates, but none of them is very large:
[campbell@computer bin]$ ls -l
total 648
-rwxr-xr-x. 1 campbell campbell 7981 Sep 25 04:30 appletviewer
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 apt
lrwxrwxrwx. 1 campbell campbell 8 Sep 25 04:31 ControlPanel -> jcontrol
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 extcheck
-rwxr-xr-x. 1 campbell campbell 7989 Sep 25 04:30 idlj
-rwxr-xr-x. 1 campbell campbell 7941 Sep 25 04:30 jar
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 jarsigner
-rwxr-xr-x. 1 campbell campbell 7750 Sep 25 04:30 java
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 javac
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 javadoc
-rwxr-xr-x. 1 campbell campbell 2050 Sep 25 00:12 javafxpackager
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 javah
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 javap
-rwxr-xr-x. 1 campbell campbell 1809 Sep 25 04:16 java-rmi.cgi
-rwxr-xr-x. 1 campbell campbell 107985 Sep 25 04:31 javaws
-rwxr-xr-x. 1 campbell campbell 7941 Sep 25 04:30 jcmd
-rwxr-xr-x. 1 campbell campbell 8029 Sep 25 04:30 jconsole
-rwxr-xr-x. 1 campbell campbell 6395 Sep 25 04:31 jcontrol
-rwxr-xr-x. 1 campbell campbell 7997 Sep 25 04:30 jdb
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 jhat
-rwxr-xr-x. 1 campbell campbell 8109 Sep 25 04:30 jinfo
-rwxr-xr-x. 1 campbell campbell 8109 Sep 25 04:30 jmap
-rwxr-xr-x. 1 campbell campbell 7941 Sep 25 04:30 jps
-rwxr-xr-x. 1 campbell campbell 7965 Sep 25 04:30 jrunscript
-rwxr-xr-x. 1 campbell campbell 7997 Sep 25 04:30 jsadebugd
-rwxr-xr-x. 1 campbell campbell 8109 Sep 25 04:30 jstack
-rwxr-xr-x. 1 campbell campbell 7941 Sep 25 04:30 jstat
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 jstatd
-rwxr-xr-x. 1 campbell campbell 2673 Jun 5 23:40 jvisualvm
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 keytool
-rwxr-xr-x. 1 campbell campbell 7965 Sep 25 04:30 native2ascii
-rwxr-xr-x. 1 campbell campbell 8149 Sep 25 04:30 orbd
-rwxr-xr-x. 1 campbell campbell 7989 Sep 25 04:30 pack200
-rwxr-xr-x. 1 campbell campbell 8013 Sep 25 04:30 policytool
-rwxr-xr-x. 1 campbell campbell 7941 Sep 25 04:30 rmic
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 rmid
-rwxr-xr-x. 1 campbell campbell 7965 Sep 25 04:30 rmiregistry
-rwxr-xr-x. 1 campbell campbell 7973 Sep 25 04:30 schemagen
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 serialver
-rwxr-xr-x. 1 campbell campbell 7981 Sep 25 04:30 servertool
-rwxr-xr-x. 1 campbell campbell 8181 Sep 25 04:30 tnameserv
-rwxr-xr-x. 1 campbell campbell 219624 Sep 25 04:30 unpack200
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 wsgen
-rwxr-xr-x. 1 campbell campbell 7973 Sep 25 04:30 wsimport
-rwxr-xr-x. 1 campbell campbell 7973 Sep 25 04:30 xjc
[campbell@computer bin]$ cd ../jre/bin
[campbell@computer bin]$ ls -l
total 424
lrwxrwxrwx. 1 campbell campbell 8 Sep 25 04:31 ControlPanel -> jcontrol
-rwxr-xr-x. 1 campbell campbell 7750 Sep 25 04:30 java
-rwxr-xr-x. 1 campbell campbell 19320 Sep 25 04:31 java_vm
-rwxr-xr-x. 1 campbell campbell 107985 Sep 25 04:31 javaws
-rwxr-xr-x. 1 campbell campbell 6395 Sep 25 04:31 jcontrol
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 keytool
-rwxr-xr-x. 1 campbell campbell 8149 Sep 25 04:30 orbd
-rwxr-xr-x. 1 campbell campbell 7989 Sep 25 04:30 pack200
-rwxr-xr-x. 1 campbell campbell 8013 Sep 25 04:30 policytool
-rwxr-xr-x. 1 campbell campbell 7957 Sep 25 04:30 rmid
-rwxr-xr-x. 1 campbell campbell 7965 Sep 25 04:30 rmiregistry
-rwxr-xr-x. 1 campbell campbell 7981 Sep 25 04:30 servertool
-rwxr-xr-x. 1 campbell campbell 8181 Sep 25 04:30 tnameserv
-rwxr-xr-x. 1 campbell campbell 219624 Sep 25 04:30 unpack200
The largest is unpack200 which is barely 200kB. Invoking the java tool probably opens a lot of other files elsewhere. There are much bigger files in the lib directory.
[campbell@computer bin]$ cd ../../lib
[campbell@computer lib]$ ls -l
total 35752
-rw-r--r--. 1 campbell campbell 398611 Sep 25 00:12 ant-javafx.jar
-rw-r--r--. 1 campbell campbell 16615601 Sep 25 04:30 ct.sym
-rw-r--r--. 1 campbell campbell 145610 Sep 25 04:30 dt.jar
-rw-r--r--. 1 campbell campbell 18432 Sep 25 04:30 ir.idl
-rw-r--r--. 1 campbell campbell 1098005 Sep 25 00:12 javafx-doclet.jar
-rw-r--r--. 1 campbell campbell 68323 Sep 25 00:12 javafx-mx.jar
-rw-r--r--. 1 campbell campbell 412830 Sep 25 04:30 jconsole.jar
-rwxr-xr-x. 1 campbell campbell 10373 Sep 25 04:30 jexec
-rw-r--r--. 1 campbell campbell 640 Sep 25 04:30 orb.idl
-rw-r--r--. 1 campbell campbell 2604938 Sep 25 04:30 sa-jdi.jar
-rw-r--r--. 1 campbell campbell 15211171 Sep 25 04:38 tools.jar
drwxr-xr-x. 6 campbell campbell 4096 Jun 14 04:58 visualvm
If you are worried about using lots of memory, you can see that the duplicate files only occupy a tiny area, < 0.5MB, compared to the lib folder.

I think this is a new question unrelated to the original thread, so I shall make a new thread from it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Duplicate files in JRE and JDK folders