How do I interact with Apache Jena locally? - MacOS

时间秒杀一切 提交于 2020-01-06 07:18:09

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/49949842/how-do-i-interact-with-apache-jena-locally-macos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!