0

I may just be going at this wrong, but I am not sure how to interact with Apache Jena on my computer. I think my main question revolves around where I store files and how I run them.

I use Atom editor and work in Python and Javascript normally. My goal here is to get a handle of how Jena and Fuseki work then potentially using Fuseki for the backend of a web app.

The tutorial, An Introduction to RDF and the Jena RDF API, links to Java files. Where do I store this file on my desktop and how can I run it?

While my question is about setting up my workspace/environment, I would appreciate feedback on more appropriate technologies.


Based on this tutorial I've gotten my workspace set up. I've removed the package identifier from my code.

Now I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/jena/rdf/model/ModelFactory at 
Tutorial01.main(Tutorial01.java:34)
Caused by: java.lang.ClassNotFoundException: 
org.apache.jena.rdf.model.ModelFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I think it's a JENAROOT Issue. I think I'm setting it and adding it to the path correctly. It's also mentioned here, but I haven't been able to troubleshoot it yet.

Anybody can point me in the right direction?

detachedhead
  • 173
  • 2
  • 8
  • 1
    Why just don't use Fuseki as an SPARQL endpoint: `localhost:3030` etc? About some common pitfalls: https://stackoverflow.com/a/43475640/7879193 – Stanislav Kralin Apr 21 '18 at 07:37
  • I may end up using Fuseki, but now I just want to figure out how to get Jena up and running. Based on [answer](https://stackoverflow.com/questions/36402759/error-could-not-find-or-load-main-class-classdemo) I removed the package identifier from my code. Now I've identified as an issue with JENAROOT or the CLASSPATH. Everything compiles, but then I get an error. – detachedhead Apr 21 '18 at 17:44
  • I have a complete example [here](https://henrietteharmse.com/2018/04/10/creating-writing-and-reading-jena-tdb2-datasets/) with example code in github that may be helpful to you. – Henriette Harmse Apr 21 '18 at 22:17

1 Answers1

0

I got help of this via the Apache Jena support email. I think I must have caused an issue by changing the environmental variables for Jena upon first use.

Based on a script I received from a community member I ran a script named jenaJarsScript.sh in terminal:

unset JARS
for f in $JENA_HOME/lib/*.jar
do
  JARS=$JARS:$f
  export JARS
done

I then added $JARS to my classpath - now I can compile and run code without an issue.

Note: I'm not sure if this is the best way to set this up, but it works for me.

detachedhead
  • 173
  • 2
  • 8