Java Eclipse::从所需的 .class 文件间接引用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29849068/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 08:41:37  来源:igfitidea点击:

Eclipse::Indirectly referenced from required .class files

javaeclipse

提问by user972418

I am facing a weird issue. When I add some external JARs to the classpath I get the error "It is indirectly referenced from required .class files". But when I remove all of them I get rid of this error. Here re the entries for .classpath

我正面临一个奇怪的问题。当我向类路径添加一些外部 JAR 时,我收到错误“它是从所需的 .class 文件间接引用的”。但是当我删除所有这些时,我摆脱了这个错误。这是 .classpath 的条目

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="bundle/src/main/java"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="C:/external_jars/cq-wcm-api-5.7.8.jar"/>
    <classpathentry kind="lib" path="C:/external_jars/cq-wcm-commons-5.7.8.jar"/>
    <classpathentry kind="lib" path="C:/external_jars/cq-wcm-core-5.7.116.jar"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

Do let me know if I need to provide any other info.

如果我需要提供任何其他信息,请告诉我。

Thanks in advance

提前致谢

采纳答案by Josh Davis

That error means you have some unresolved dependency, i.e. one of those jar files depends on some other jar file that you have not added to your classpath.

该错误意味着您有一些未解决的依赖项,即这些 jar 文件之一依赖于您尚未添加到类路径中的其他一些 jar 文件。

I believe this is a duplicate of: Eclipse error: indirectly referenced from required .class files?

我相信这是重复的:Eclipse 错误:从所需的 .class 文件间接引用?

回答by Shayan Ghosh

one of the class that you use needs another class which is not in classpath.Just add the required jar to the classpath.Also clean the workspace.Missing file's name will be in the error message.

您使用的一个类需要另一个不在类路径中的类。只需将所需的 jar 添加到类路径中。同时清理工作区。缺少文件的名称将出现在错误消息中。