title: Why do almost all Java binaries have the same size
body: <p>I just noticed that binaries in <code>bin</code> in an old JRockit JDK 6 on CentOS 6, OpenJDK 8 on Ubuntu 18.10 and Oracle JDK 11 on Windows 11 have approximately the same size.</p>
  
  <pre><code>$ ls -la /usr/lib/jvm/java-8-openjdk-amd64/bin/
  insgesamt 472
  drwxr-xr-x 2 root root  4096 Jan 31 08:03 .
  drwxr-xr-x 7 root root   144 Jan 31 08:03 ..
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 appletviewer
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 extcheck
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 idlj
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jar
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jarsigner
  lrwxrwxrwx 1 root root    15 Jan 14 22:02 java -&gt; ../jre/bin/java
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 javac
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 javadoc
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 javah
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 javap
  -rwxr-xr-x 1 root root  2806 Jan 14 22:02 java-rmi.cgi
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jcmd
  -rwxr-xr-x 1 root root 14528 Jan 14 22:02 jconsole
  -rwxr-xr-x 1 root root 14520 Jan 14 22:02 jdb
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jdeps
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jhat
  -rwxr-xr-x 1 root root 14552 Jan 14 22:02 jinfo
  lrwxrwxrwx 1 root root    14 Jan 14 22:02 jjs -&gt; ../jre/bin/jjs
  -rwxr-xr-x 1 root root 14552 Jan 14 22:02 jmap
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jps
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jrunscript
  -rwxr-xr-x 1 root root 14520 Jan 14 22:02 jsadebugd
  -rwxr-xr-x 1 root root 14552 Jan 14 22:02 jstack
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jstat
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 jstatd
  lrwxrwxrwx 1 root root    18 Jan 14 22:02 keytool -&gt; ../jre/bin/keytool
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 native2ascii
  lrwxrwxrwx 1 root root    15 Jan 14 22:02 orbd -&gt; ../jre/bin/orbd
  lrwxrwxrwx 1 root root    18 Jan 14 22:02 pack200 -&gt; ../jre/bin/pack200
  lrwxrwxrwx 1 root root    21 Jan 14 22:02 policytool -&gt; ../jre/bin/policytool
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 rmic
  lrwxrwxrwx 1 root root    15 Jan 14 22:02 rmid -&gt; ../jre/bin/rmid
  lrwxrwxrwx 1 root root    22 Jan 14 22:02 rmiregistry -&gt; ../jre/bin/rmiregistry
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 schemagen
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 serialver
  lrwxrwxrwx 1 root root    21 Jan 14 22:02 servertool -&gt; ../jre/bin/servertool
  lrwxrwxrwx 1 root root    20 Jan 14 22:02 tnameserv -&gt; ../jre/bin/tnameserv
  lrwxrwxrwx 1 root root    20 Jan 14 22:02 unpack200 -&gt; ../jre/bin/unpack200
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 wsgen
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 wsimport
  -rwxr-xr-x 1 root root 14504 Jan 14 22:02 xjc
  </code></pre>
  
  <p>This seems odd since they nothing in common in the tasks they fulfill (e.g. <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/unix/wsimport.html" rel="noreferrer">wsimport</a> and <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/unix/xjc.html" rel="noreferrer">xjc</a>). Diffing a hexdump shows that the binaries only differ by a few Bytes while being relatively large.</p>