我在Eclipse中出现了一个错误。这个错误信息是什么意思:

无法解析iglu.ir.TermVector类型。它是从必需的.class文件中间接引用的


当前回答

我在Eclipse 4.4.2中遇到过一个有趣的案例。我的项目(P1)引用了一个外部类(项目P2),它有两个同名但参数类型不同的方法:

public static void setItem(Integer id) …
public static void setItem(Item item) …

类型Item包含在第三个项目P3中,我不想在这里看到它。P1只调用了第一个方法:

ExternalClass.setItem(Integer.valueOf(12345));

因此,使用Item类的第二个方法没有被使用,而且P3确实不在编译类路径中——如果没有被使用,为什么要使用它呢?

Eclipse告诉我

The type ...Item cannot be resolved.
It is indirectly referenced from required .class files

从命令行编译不会产生任何此类问题。更改第二个方法的名称(此处未使用!)也使这个问题在Eclipse中消失了。

其他回答

我在Eclipse 4.4.2中遇到过一个有趣的案例。我的项目(P1)引用了一个外部类(项目P2),它有两个同名但参数类型不同的方法:

public static void setItem(Integer id) …
public static void setItem(Item item) …

类型Item包含在第三个项目P3中,我不想在这里看到它。P1只调用了第一个方法:

ExternalClass.setItem(Integer.valueOf(12345));

因此,使用Item类的第二个方法没有被使用,而且P3确实不在编译类路径中——如果没有被使用,为什么要使用它呢?

Eclipse告诉我

The type ...Item cannot be resolved.
It is indirectly referenced from required .class files

从命令行编译不会产生任何此类问题。更改第二个方法的名称(此处未使用!)也使这个问题在Eclipse中消失了。

我得到这个异常,因为eclipse在不同版本的jdk中工作,只是更改为正确的,清洁和构建并工作!

我得到的错误,当我只是改变一些svn设置,而不是在代码中的任何东西。只是清理项目修复了错误。

在我的例子中,问题是“javax.ws.rs”。在Tomcat中启动web应用程序时,执行webapplicationexception无法解决。

添加以下库(Maven)的解决方案:

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.0</version>
</dependency>

In my case ,I created a project and made its minSdkVersion=9 and targetSdkVersion=17. I used automatically generated libs/android-support-v4.jar. I also had to make use of ActionBarActivity using android-support-v7-appcomapt.jar. So I just copied the android-support-v7-appcompat.jar file from android-sdk/extras/andrid/support/v7/appcompat/libs folder and pasted it to my project libs folder. And this caused the above error. So basically,I needed to put android-support-v4.jar file from android-sdk/extras/andrid/support/v7/appcompat/libs as well to my project libs folder. As per my knowledge the v7.jar file had dependencies on v4.jar file. So ,it needed it own v4.jarfile,instead of my project,automatically created v4.jar file.