Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Eclipse中将第三方库集成到Android_Java_Android_Eclipse_Stanford Nlp_Buildpath - Fatal编程技术网

Java 如何在Eclipse中将第三方库集成到Android

Java 如何在Eclipse中将第三方库集成到Android,java,android,eclipse,stanford-nlp,buildpath,Java,Android,Eclipse,Stanford Nlp,Buildpath,我正试图通过以下教程将Stanford POS tagger集成到我的android应用程序中: 这些是我遵循的步骤 我创建了一个名为taggers的新文件夹,并在其中保存了.taggers和.props文件 我通过右键单击我的项目>配置构建路径>添加外部JAR将库导入到我的项目中 然后我写了我的代码 package cct.mad.numbers; import edu.stanford.nlp.tagger.maxent.MaxentTagger; import android.app.Ac

我正试图通过以下教程将Stanford POS tagger集成到我的android应用程序中:

这些是我遵循的步骤

  • 我创建了一个名为taggers的新文件夹,并在其中保存了.taggers和.props文件

  • 我通过右键单击我的项目>配置构建路径>添加外部JAR将库导入到我的项目中

  • 然后我写了我的代码

    package cct.mad.numbers;
    import edu.stanford.nlp.tagger.maxent.MaxentTagger;
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.TextView;
    public class sum2 extends Activity{
    
    MaxentTagger tagger = new MaxentTagger("taggers/left3words-wsj-0-18.tagger");   
    private TextView text;
    String sample = "This is a sample text";
    
    
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text2);
    
    text = (TextView)findViewById(R.id.news);
    // The tagged string
    String tagged = tagger.tagString(sample);
    
    text.setText(tagged);
    }
    
    }
    
  • 然而,它给出了一个错误

        MaxentTagger tagger = new MaxentTagger("taggers/left3words-wsj-0-18.tagger");
    
    说明:“默认构造函数无法处理隐式超级构造函数引发的异常类型ClassNotFoundException。必须定义显式构造函数”

    当我将鼠标悬停在上面时,上面代码中的MaxentTagger和

      import edu.stanford.nlp.tagger.maxent.MaxentTagger;
    
    它说:“注意:这个元素既没有附加的源代码也没有附加的Javadoc,因此找不到Javadoc”


    我应该如何解决这个问题?

    请先将库项目复制到工作区,然后再尝试添加外部jar…

    我不知道怎么做。这就是我的问题。首先,你需要在你的工作区中导入库项目。单击文件,选择导入选项。选择现有的android代码,勾选复选框,将项目复制到工作区,然后单击确定。。。然后尝试设置项目的library属性……这是不可能的,因为“Stanford POS tagger”不是android代码。我甚至尝试将文件保存在assets文件夹中,并在assets文件夹中构建一个路径,但仍然不起作用