Monday, March 21, 2016

Fix Unsupported major.minor version

Source: stockoverflow

Sometimes when you build your project with wrong java version and run your project, you get this kind of error, below is a guide to what java version is needed when this error occurs...

The version number shown describes the version of the JRE the class file is compatible with.
The reported major numbers are:
J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45

Source: stockoverflow postgres
If you encounter this error, PostgreSQL unsupported major.minor version
java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0 (unable to load class org.postgresql.Driver)

This means that the postgres driver you're using does not support the java version used to build your project.

You can check here in postgres documentation the jdbc version you need if you're running a certain java version: https://jdbc.postgresql.org/download.html

Below are the details found in this page...

If you are using the 1.6 then you should use the JDBC4 version. If you are using 1.7 then you should use the JDBC41 version. If you are using 1.8 then you should use the JDBC42 versionIf you are using a java version older than 1.6 then you will need to use a JDBC3 version of the driver, which will by necessity not be current