-1

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

enter image description here

sunxd
  • 743
  • 1
  • 9
  • 24
  • On the left side of IntelliJ there's a project view, do you have your library listed here (bottom)? If so, click all the "+" of the library tree and post a screenshot of that in your question –  Oct 23 '15 at 18:54

2 Answers2

1

Jena 3.0.0 renamed the packages (one reason for being a major version change).

com.hp.hpl.jena => org.apache.jena.

AndyS
  • 16,345
  • 17
  • 21
0

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

sunxd
  • 743
  • 1
  • 9
  • 24