简体   繁体   English

创建猫头鹰文件时出错

[英]Error in creating owl file

I want to create ontology whit this code: 我想用以下代码创建本体:

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");

} 

But it gives this error: 但是它给出了这个错误:

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

I cannot understand what is the problem.Thanks for any Help. 我不明白这是什么问题。谢谢您的帮助。

NoClassDefFoundError means the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found. NoClassDefFoundError表示Java虚拟机或ClassLoader实例尝试加载类的定义(作为常规方法调用的一部分或使用新表达式创建新实例的一部分),并且找不到该类的定义。

Try to download Apache Jena library from here and put it in your classpath 尝试从此处下载Apache Jena库并将其放在您的类路径中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM