gerrit 2.1-rc1
Teach Main to check the Java runtime version

To run Gerrit Code Review we require Java 6, because our class
files are compiled against the Java 6 SDK, use methods from it,
and are in the Java 6 bytecode file format.  We cannot run on a
JRE that predates the Java 6 specification.

Rather than giving users who are trying to run us on an outdated
virutal machine an obtuse stack trace like the following:

  Exception in thread "main" java.lang.UnsupportedClassVersionError:
      Bad version number in .class file
	at java.lang.ClassLoader.defineClass1(Native Method)

we should give them a specific message describing the problem,
and our minimum version requirement.

To get a custom error message we compile our Main springboard class
in Java 1.2 format, against only APIs that are available since Java
1.2, and we check the specification of our runtime to verify it can
support us.  This allows us to execute on a really old JRE and at
least report a descriptive error message.

In order to use Java 6 APIs in GerritLauncher we had to move it
to its own Maven component, where the runtime environment is still
described as Java 6.

Change-Id: I47bfcfb5076427d491c896a2815dd091ca205bfc
Signed-off-by: Shawn O. Pearce <>
16 files changed