You should always run the most recent version of the Java Virtual Machine (JVM),
unless otherwise stated on the Elasticsearch website. Elasticsearch, and in
particular Lucene, is a demanding piece of software. The unit and integration
tests from Lucene often expose bugs in the JVM itself. These bugs range from
mild annoyances to serious segfaults, so it is best to use the latest version of
the JVM where possible.

Java 8 is preferred over Java 7. Java 6 is no longer supported. Either Oracle or
OpenJDK are acceptable. They are comparable in performance and stability.

If your application is written in Java and you are using the transport client or
node client, make sure the JVM running your application is identical to the
server JVM. In few locations in Elasticsearch, Java’s native serialization is
used (IP addresses, exceptions, and so forth). Unfortunately, Oracle has been
known to change the serialization format between minor releases, leading to
strange errors. This happens rarely, but it is best practice to keep the JVM
versions identical between client and server.

Please Do Not Tweak JVM Settings

The JVM exposes dozens (hundreds even!) of settings, parameters, and
configurations. They allow you to tweak and tune almost every aspect of the JVM.

When a knob is encountered, it is human nature to want to turn it. We implore
you to squash this desire and not use custom JVM settings. Elasticsearch is a
complex piece of software, and the current JVM settings have been tuned over
years of real-world usage.

It is easy to start turning knobs, producing opaque effects that are hard to
measure, and eventually detune your cluster into a slow, unstable mess. When
debugging clusters, the first step is often to remove all custom configurations.
About half the time, this alone restores stability and performance.