Unsupported major.minor version 52.0 -- Java compile & runtime versions

When running your Elastic COBOL application under different environments you may see some variation of:

  • Unsupported major.minor version xx.x

such as

  • Unsupported major.minor version 52.0 (Oracle JVM)
  • Unsupported major.minor version 51.0 (Oracle JVM)
  • JVMCFR003 Bad major version (IBM JVM)
This message appears on the standard error output when running an Elastic COBOL application using the java command or on the Web page when running the application or transaction under a Java Application Server such as Red Hat JBOSS, Oracle Weblogics, IBM Websphere or Java Servlet Engines such as Apache Tomcat or Eclipse Jetty when the version of java you have installed is out-of-date and no longer supported by the Java vendors.
The issue has to do with the difference in Java versions used to compile and run your application.  If you are using the latest version of Eclipse IDE to compile your Elastic COBOL application it will choose the latest "Java compatibility version" on the desktop environment. When you run the application it will use the version of the Java Virtual Machine installed at that location.  The javac (compiler) and the java (runtime) must be the same version or the compiler must be older than the runtime or you need to compile the Java source in such a way that it is compatible with an older version of the JVM.
Note:  External Java version numbering changed after what was known as Java 1.7.  The next version was Java 8.  The internal version numbering is remaining consistent.  Java 1.7 has internal version number 51.0 and Java 8 has internal version number 52.0.  Note also that the external Java version numbering is changing yet again after version 10 was first released March, 2018.  Each version will be tagged with the year and month that it becomes available. The release of Java 10 available at that time is also known as 18.3.  See for more info.
Oracle currently support Java versions 8 (a.k.a 1.8, a.k.a 52.0) and 9 (a.k.a. 1.9, a.k.a 53.0) and no longer supports earlier versions (1.02, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7).  IBM currently supports versions 1.7 on z/OS and AIX with a support contract, but prefer you upgrade to the latest version.  To see what version you have on your development and deployment systems enter the command prompt window:
  • javac -version
  • java -version 
Then, check and correct if necessary the version of Java used by Eclipse to compile your application.  Under Window > Preferences > Java > Compiler menu:

The above "compiler compliance level" will cause Eclipse to use the javac option -target 8 (generate a class file to be able to run on a potentially-down level Java 8 runtime environment) and -source 8 (the program uses only this level of language and runtime constructs).  If you use the ecobol command from the command-line or from  make, ant or maven build tools then the Elastic COBOL compiler will normally invoke the Java compiler (javac) after a successful COBOL compile.   The javac from the current $PATH will generate class files compatible with its version, whatever that is. The -source and -target options are not set.  If you know that you will be running a program on a different machine with a different Java virtual machine level, you should compile the generated Java to the down-level version.  You can influence the source/target through two Elastic COBOL options:
  • -out:javaversion 8 -- causes ecobol to generate Java source code compliant with version 8 and use javac -source 8 -target 8 options
  • -script:javac '/usr/myjava/javac -deprecated -source 8 -target 8' -- causes ecobol to use the indicated command line (with appended classpath) to compile Java source code

Alternatively, you can compile the Java yourself and ask the ecobol command to not generate .class files from .java files with the first of the following options:

  • -out:java -- causes ecobol to generate Java source code, but not invoke the javac compiler afterwards
  • -out:class -- causes ecobol to generate Java source code, then invoke the javac compiler to generate .class files (default)
Note: The Elastic COBOL runtime is compiled to be compatible with Java 8 and higher (-source 8 -target 8).  Programs compiled with ecobol to specify -out:javaversion 1.7 or earlier (or compiling its output, the intermediate Java source, with the javac -target 1.7 or earlier) will not interoperate with the Elastic COBOL runtime and produce the Unsupported major.minor version error.  You must update to JVM to Java 8 or later.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


  • 0

    The jarcheck application here ; is really useful for determining what version each file in a jar is compiled with.

    The following command line with check a jar file doesn't contain anything before 1.1 and after 1.7 : 

    java -ea -jar jarcheck/jarcheck.jar <jar filename> 1.1 1.7

    The jarcheck application is compiled with 1.8 but the source is included for you to recompile with your java compiler and then test.

    Recompile using 


    And then run like this:

    java com.mindprod.jarcheck.JarCheck <jar filename> 1.1 1.7
    Edited by ian
Please sign in to leave a comment.
Powered by Zendesk