How to solve "Error: Could not find or load main class arq.sparql" when trhing to run the `sparql` CLI tool from Apache Jena?

Based on https://jena.apache.org/documentation/tools/ I tried:

sudo apt install openjdk-22-jre
wget https://dlcdn.apache.org/jena/binaries/apache-jena-4.10.0.zip
wget https://dlcdn.apache.org/jena/source/jena-4.10.0-source-release.zip
unzip apache-jena-4.10.0.zip
cd jena-4.10.0
export JENA_HOME="$(pwd)"
export PATH="$PATH:$(pwd)/apache-jena/bin"

but then when I tried to run:

sparql

it failed with:

Error: Could not find or load main class arq.sparql
Caused by: java.lang.ClassNotFoundException: arq.sparql

Upvotes: 1

Views: 236

Answers (1)

The problem is that I downloaded the source distribution from the downloads page https://jena.apache.org/download/index.cgi, instead you have to download the prebuilt one which contains the JAR files (or build them yourself):

sudo apt install openjdk-22-jre
wget https://dlcdn.apache.org/jena/binaries/apache-jena-4.10.0.zip
unzip apache-jena-4.10.0.zip
cd apache-jena-4.10.0
export JENA_HOME="$(pwd)"
export PATH="$PATH:$(pwd)/bin"

and we can confirm it works with:

sparql -version

which outputs:

Apache Jena version 4.10.0

Upvotes: 0

Related Questions