我想用这段代码创建本体:
public static void main(String[] args) throws FileNotFoundException {
// TODO code application logic here
OntModel my_model= ModelFactory.createOntologyModel();
ObjectProperty op = my_model.createObjectProperty("b");
OntClass my_class = my_model.createClass("student");
DatatypeProperty dtp = my_model.createDatatypeProperty("name");
dtp.addDomain(my_class);
FileOutputStream univer= new FileOutputStream("c:/uni.owl");
my_model.write(univer,"RDF/XML-ABBREV","ns");
}
但它给出了这个错误:
java.lang.NoClassDefFoundError: com/hp/hpl/jena/rdf/model/Resource
Caused by: java.lang.ClassNotFoundException: com.hp.hpl.jena.rdf.model.Resource
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: javaapplication6.Main. Program will exit.
Exception in thread "main" Java Result: 1
我不明白是什么问题。感谢您的帮助。