如何在本地与Apache Jena交互? - 苹果系统 [英] How do I interact with Apache Jena locally? - MacOS

查看:152
本文介绍了如何在本地与Apache Jena交互? - 苹果系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可能只是犯错了,但是我不确定如何与计算机上的Apache Jena进行交互.我认为我的主要问题围绕着我在哪里存储文件以及如何运行它们.

我使用Atom编辑器并正常使用Python和Javascript.我的目标是了解Jena和Fuseki的工作方式,然后潜在地将Fuseki用作Web应用程序的后端.

该教程 RDF和Jena RDF API简介,链接到 Java文件.该文件在我的桌面上的哪里存储以及如何运行?

尽管我的问题是关于设置工作区/环境,但我希望您能获得有关更合适技术的反馈.


基于此教程设置好我的工作区.我从我的代码中删除了包标识符

现在我收到此错误:

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)

我认为这是一个JENAROOT问题.我认为我正在对其进行设置并将其正确添加到路径中 .还提到了此处,但是我还无法对其进行故障排除.

有人能指出我正确的方向吗?

解决方案

我通过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?

解决方案

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.

这篇关于如何在本地与Apache Jena交互? - 苹果系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆