2017-11-07 15 views
0

stanford corenlp zipファイルをhttps://stanfordnlp.github.io/CoreNLP/からダウンロードし、解凍してcd'edします。今私は、次のJavaファイルを実行しようとしました。 javac -cp "*" SentimentAnalysis.java worksでも問題ありませんが、java SentimentAnalysisはスレッド "main" java.lang.NoClassDefFoundError:edu/stanford/nlp/pipeline/StanfordCoreNLPのExceptionをスローします。スレッドmainの例外java.lang.NoClassDefFoundError:edu/stanford/nlp/pipeline/StanfordCoreNLP

import edu.stanford.nlp.pipeline.*; 

import java.util。*;

Exception in thread "main" java.lang.NoClassDefFoundError: edu/stanford/nlp/pipeline/StanfordCoreNLP 
    at SentimentAnalysis.main(SentimentAnalysis.java:39) 
Caused by: java.lang.ClassNotFoundException: edu.stanford.nlp.pipeline.StanfordCoreNLP 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 1 more 
+0

に従って存在する場合に必要なクラスStanfordCoreNLPが

  • 存在し、あなたが何 'java.lang.NoClassDefFoundErrorのを研究しているかどうかを確認しますそれは? –

  • 答えて

    0

    がからJava decomilerをダウンロードするステップ

    • 下に使用してjarファイルを確認し、以下のように

      パブリッククラスSentimentAnalysis {

      public static void main(String[] args) { 
      
          // creates a StanfordCoreNLP object, with POS tagging, lemmatization, NER, parsing, and coreference resolution 
          Properties props = new Properties(); 
          props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref"); 
          StanfordCoreNLP pipeline = new StanfordCoreNLP(props); 
      
          // read some text in the text variable 
          String text = "Hello madam, this is a dam"; 
      
          // create an empty Annotation just with the given text 
          Annotation document = new Annotation(text); 
      
          // run all Annotators on this text 
          pipeline.annotate(document); 
      
      } 
      

      }

      エラーでありますダウンロードされたデコンパイラ

    • 経由

    • オープンjarファイルのクラスは、この記事how to run Java program including jar

    +0

    センチメント分析は、実行しようとしているJavaファイルの名前です –

    +0

    私の提案は助けになりましたか? –

    +0

    実際、問題はスタンフォードのcorenlpクラスが私自身の関数で見つからないということです。 –