Received error message: Exception in thread "main" java.lang.UnsupportedClassVersionError: WhatJavaVersion (Unsupported major.minor version 48.0)
You need a Java Runtime Environment (JRE) on any machine that is going to execute Java applications. If you are going to develop mixed Java and COBOL applications, you also need a Java Development Kit (JDK).
To add the Java support to the COBOL environment, you must run the cobsje script
The cobsje script does several things including:
1) Runs $JAVA_HOME/bin/java WhatJava to obtain the Java version
2) Checks that the version of Java is supported
Your COBOL development system currently supports several Java versions.
To find the version that is supported, read $COBDIR/docs/env.txt
The UnsupportedClassVersionError will list what version of java it needs (note the example requires version 48)
Major Class Versions of Java JDK
JDK 1.1 = 45
JDK 1.2 = 46
JDK 1.3 = 47
JDK 1.4 = 48
JDK 1.5 = 49
JDK 1.6 = 50
This error occurs if a higher JDK version is used to compile the java source file into .class or .jar files and a lower JDK version is used to run the .class or .jar files.
For example if you compile your java source file in JDK 1.4 and you try to run it on JDK 1.3 you will get the UnsupportedClassVersionError.
Please note that older .class files will run on newer versions of Java, just not the other way around.
The example attempted to run cobsje using java 1.3.0 but cobsje required at least java 1.4.0
Therefore, the solution is to install a newer version of java and then rerun cobsje.