简体   繁体   中英

Protege-OWL: java.lang.NoClassDefFoundError

Im trying to run code use protege-owl. So I added the protege.jar and protege-owl.jar to library to import edu.stanford.smi.protegex.owl.* and edu.stanford.smi.protege.* .

I also added jena jar files to use in next steps.

First i wrote simple code to see how it works :

 import java.lang.Object;
 import edu.stanford.smi.protege.*;
 import edu.stanford.smi.protegex.owl.*;
 import edu.stanford.smi.protegex.owl.jena.JenaOWLModel;
 import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
public class Main {
    public static void main(String[] args) {
           // TODO code application logic here
          JenaOWLModel model=ProtegeOWL.createJenaOWLModel();
          OWLNamedClass c= model.createOWLNamedClass("A");
          System.out.print(c.getName());   
       }
}

But it gives me this error :

CONFIG: Protege 3.0 Build 141, JVM 1.6.0_20-b02, memory=259M, Windows 7, encoding=UTF-8, language=fa, country=IR
WARNING: Look and feel not found: com.jgoodies.plaf.plastic.PlasticLookAndFeel -- SystemUtilities.loadLookAndFeel()
WARNING: Plugins directory not found: C:\Users\mona\Documents\NetBeansProjects\JavaApplication3\plugins -- PluginUtilities.getPluginsDir()
WARNING: Exception Caught -- java.lang.NoClassDefFoundError: com/toedter/calendar/JDateChooser
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at edu.stanford.smi.protege.plugin.PluginUtilities.isLoadableClass(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.checkPlugin(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.checkPlugins(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.processManifest(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.loadPluginsWithClassLoader(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.createClassLoaderAndLoadPlugins(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.loadPlugins(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.loadSystemPlugins(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.loadPlugins(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.init(Unknown Source)
        at edu.stanford.smi.protege.plugin.PluginUtilities.<clinit>(Unknown Source)
        at edu.stanford.smi.protege.util.SystemUtilities.init(Unknown Source)
        at edu.stanford.smi.protege.util.SystemUtilities.<clinit>(Unknown Source)
        at edu.stanford.smi.protege.model.Project.<clinit>(Unknown Source)
        at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModel(ProtegeOWL.java:32)
        at javaapplication3.Main.main(Main.java:25)
Caused by: java.lang.ClassNotFoundException: com.toedter.calendar.JDateChooser
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method) . . . .

What can I do ?


Update: I replace protege.jar with protege-3.5.jar and now it gives :

Exception in thread "main" java.lang.NoSuchMethodError: edu.stanford.smi.protege.model.SystemFrames.replaceFrame(Ledu/stanford/smi/protege/model/Frame;)V
        at edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel.createSystemFrames(AbstractOWLModel.java:544)
        at edu.stanford.smi.protege.model.DefaultKnowledgeBase.<init>(DefaultKnowledgeBase.java:79)
        at edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel.<init>(AbstractOWLModel.java:318)
        at edu.stanford.smi.protegex.owl.jena.JenaOWLModel.<init>(JenaOWLModel.java:62)
        at edu.stanford.smi.protegex.owl.jena.JenaKnowledgeBaseFactory.createKnowledgeBase(JenaKnowledgeBaseFactory.java:55)
        at edu.stanford.smi.protege.model.Project.createDomainKB(Project.java:429)
        at edu.stanford.smi.protege.model.Project.createDomainKnowledgeBase(Project.java:447)
        at edu.stanford.smi.protege.model.Project.<init>(Project.java:359)
        at edu.stanford.smi.protege.model.Project.<init>(Project.java:341)
        at edu.stanford.smi.protege.model.Project.createNewProject(Project.java:545)
        at edu.stanford.smi.protegex.owl.ProtegeOWL.createJenaOWLModel(ProtegeOWL.java:32)
        at javaapplication3.Main.main(Main.java:24)
Java Result: 1

Where is the problem?

我从其他链接下载了3.24MB的protege-owl.jar,现在可以使用了。

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.

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