I clicked file->project structure->libraries
and added apache-jena-3.0.0/lib
, /libsrc
and javadoc-core
.
Then I copied the tutorial in the src-example folder to the src file of my intellij project, then
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.*;
public class Tutorial01 extends Object {
// some definitions
static String personURI = "http://somewhere/JohnSmith";
static String fullName = "John Smith";
public static void main (String args[]) {
// create an empty model
Model model = ModelFactory.createDefaultModel();
// create the resource
Resource johnSmith = model.createResource(personURI);
// add the property
johnSmith.addProperty(VCARD.FN, fullName);
}
}
Then it said couldn't resolve hp, MOdel, Resource. Anyone knows why?
jena version 3.0.0
ubuntu 15.04
intellij 14.1.4
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
whereis java: /jvm/java-8-oracle/jre/bin/java
Jena 3.0.0 renamed the packages (one reason for being a major version change).
com.hp.hpl.jena => org.apache.jena.
Finally I found a solution.
I put all the jar file in the project folder and add them, now it works.
But if the jar files are not in the project folder, using -project setting library import does not work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.