我正在编写一个使用Netbeans创建RDF文件的程序。它在线程“main”java.lang.NoClassDefFoundError:org / slf4j / LoggerFactory中得到错误Exception。
import java.io.*;
import java.lang.*;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.*;
public class RDFWriter extends Object
{
public static void main (String args[])
{
String personURI = "http://localhost/hrudya";
String givenName = "GOPIKA";
String familyName = "NG";
String fullName = givenName + " " + familyName;
String course1 = "http://localhost/relationship/";
try {
// create an empty model
Model model = ModelFactory.createDefaultModel();
// create the resource and add the properties cascading style
Resource hrudya = model.createResource(personURI);
Property course = model.createProperty(course1,"course");
hrudya.addProperty( VCARD.FN, fullName);
hrudya.addProperty( VCARD.Given, givenName);
hrudya.addProperty( DC.title, "SEMANTIC WEB");
hrudya.addProperty(course,"M.Tech_CSE");
//model.write(new PrintWriter(System.out));
FileOutputStream fout=new FileOutputStream("p2cse10009/Desktop/rr.rdf");
model.write(fout);
FileOutputStream fout1=new FileOutputStream("p2cse10009/Desktop/hr.xml");
model.write(fout1);
}
catch (Exception e)
{
System.out.println("Failed: " + e);
}
}
public RDFWriter() {
}
}
我应该添加哪个库?
答案 0 :(得分:1)
答案 1 :(得分:1)
答案 2 :(得分:1)
您需要在Jena的POM中列出的依赖项。见http://repo1.maven.org/maven2/com/hp/hpl/jena/jena/2.6.4/jena-2.6.4.pom