有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java持久性找不到类定义错误和外部JAR问题

我的代码是

import 安卓.os.Bundle;
import rita.wordnet.RiWordnet;
import java.util.*;
import 安卓.app.Activity;
import 安卓.content.IntentSender;
import 安卓.view.Menu;
import 安卓.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    TextView strlab;
    strlab=(TextView)findViewById(R.id.textView1);
    RiWordnet wordnet = new RiWordnet();
    String word = "diode";
    System.out.println("\nFinding parts of speech for " + word + ".");
    String[] partsofspeech = wordnet.getPos(word);
    for (int i = 0; i < partsofspeech.length; i++) {
        strlab.setText(""+partsofspeech[i]);            
    }


}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
}

它编译得很好。我正在使用适用于windows的最新版本的Android SDK ADT捆绑包。当我运行应用程序时,它会意外停止

我正在使用RITA Wordnet jar文件。我通过简单地将它们复制到libs文件夹来添加它们

我知道jar文件需要java 5.0或6.0。因此,我在项目属性中的Java编译器选项中将设置更改为1.6。我还了解到,添加罐子的“订购和出口”方法已经过时

有人能帮我吗

编辑: 添加我的日志猫的屏幕截图

enter image description here

enter image description here


共 (2) 个答案

  1. # 1 楼答案

    在Eclipse中转到Poject Explorer,然后选择Property->Java Build Path ->Order and Export,然后只选中Android Private LibrariesAndroid Dependencies上的勾号,如果以前选中过,则取消选中所有jar文件。告诉我们它是否有效