CAST HIGHLIGHT - CLI - A JNI error has occurred, please check your installation and try again

While executing the command for HL scan you may get the following error :
09:02:17 Error: A JNI error has occurred, please check your installation and try again
09:02:17 Exception in thread "main" java.lang.UnsupportedClassVersionError: com/castsoftware/highlight/HighlightAutomation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

 

Details

The error here  is coming because the version of Java required by the application is not installed.
Referring to the doc below, java 11 and above is required.
https://doc.casthighlight.com/product-tutorials-third-party-tools/automated-code-scan-command-line/
JRE 8 active support ended on 31st March 2022, the newer versions of CAST Highlight's Command Line requires JRE 11 as a minimum, for Highlight command line version 5.4.9 which was released on Saturday April 2nd 2022. If your JRE needs an upgrade, you will typically see the below error when using the command line:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/castsoftware/highlight/HighlightAutomation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

 

For Windows
Java 11 and above is required

Prior to using the command line, it is preferable to install the Highlight Local Agent on your machine, in order to embed the required Perl binaries. Alternatively, you can install the required Perl distribution (Strawberry) if you don’t want to install the Local Agent. The Local Agent can be downloaded from your Highlight user account, from the APPLICATION SCANS page.

In case the command line still has the issue, check your environment variables to ensure JAVA_HOME and path point to the right folder (of the new JRE version):
mceclip1.png

 

For Linux Debian/Ubuntu

The following components must be installed on your machine: Perl 5 (tested on Strawberry 5.12.3.0), libjson-perl, libxml-libxml-perl

$>perl -v
on debian/ubuntu systems
$>dpkg –get-selections libxml-libxml-perl libjson-perl

Java 11 and above
$>java -version

NB: JDK version can be found out from a keyword scan. Please refer  https://doc.casthighlight.com/how-to-detect-apps-using-oracles-jdk-1-8-others-portfolio-level/ 
or do a $>java -version
Previous versions of the command line (5.4.8 and earlier) should still work on JRE 8.
Don't hesitate to contact the support team for any assistance (help@castsoftware.com).
Have more questions? Submit a request

Comments

Powered by Zendesk