Home > database >  java.lang.UnsupportedClassVersionError trying to run Jena ARQ to follow along with O'Reilly SPA
java.lang.UnsupportedClassVersionError trying to run Jena ARQ to follow along with O'Reilly SPA

Time:03-20

I'm trying to get Jena ARQ as suggested in O'Reilly SPARQL 1.1 book so I can follow along with the query examples in the book. I've downloaded apache-jena-.4.0.zip from jena.apache.org/download/index.cgi and follwed the instructions to extract and set JENA_HOME and PATH environmet variables.

When I run ARQ.bat from windows cmd terminal I get

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: arq/arq 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

Reading help on that error message on this forum and elsewhere suggests I either recompile the class (I can't do that) or update Java runtime. So I've removed and reinstalled Java JRE 64--bit for Windows from https://www.java.com/en/download/ 64-bit Java for Windows Release date: January 18, 2022

and rebooted machine.

Running java -version from cmd prompt gives me

Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)

However the java.lang.UnsupportedClassVersionError persists

Any ideas please? Or any other simple way of executing a SPARQL query file against a local data file so I can can follow along withe th SPARQL book?

CodePudding user response:

Class file version 55.0 is equivalent to Java 11 (can be seen for example here). However, the Java version you install from java.com is Java 8. Therefore you need to use at least Java 11, but newer versions (e.g. Java 17) might work as well.

You can obtain newer versions of the Oracle JDK here, or you can use Open JDK builds, for example from here. See for example this question for differences between the Oracle JDK and Open JDK.

  • Related