eclipse 无法加载依赖类 com/jcraft/jsch/Logger

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16738118/
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-09-19 20:35:52  来源:igfitidea点击:

Could not load a dependent class com/jcraft/jsch/Logger

javaeclipseantjarjsch

提问by Dims

While trying to execute target in Eclipse's ant, containing scptask, I am getting an error

尝试在ant包含scp任务的Eclipse 中执行目标时,出现错误

BUILD FAILED
D:\Users\Dims\Design\liferay-plugins-sdk-6.1.1-tomcat-6.0.37-x64-liferay-6.1-GA2\portlets\scisbo-portlet\build.xml:11: Problem: failed to create task or type scp
Cause: Could not load a dependent class com/jcraft/jsch/Logger
       It is not enough to have Ant's optional JARs
       you need the JAR files that the optional tasks depend upon.
       Ant's optional task dependencies are listed in the manual.
Action: Determine what extra JAR files are needed, and place them in one of:
        -D:\APPS\eclipse-liferay-ide\plugins\org.apache.ant_1.8.2.v20120109-1030\lib
        -C:\Users\dims\.ant\lib
        -a directory added on the command line with the -lib argument

Do not panic, this is a common problem.
The commonest cause is a missing JAR.

This is not a bug; it is a configuration problem

I have done what it is written here and put JAR file

我已经完成了这里写的内容并放置了 JAR 文件

D:\...eclipse-liferay-ide\plugins\org.apache.ant_1.8.2.v20120109-1030\lib>dir
ant-antlr.jar         ant-apache-oro.jar       ant-commons-logging.jar  ant-jdepend.jar  ant-junit4.jar    ant-testutil.jar
ant-apache-bcel.jar   ant-apache-regexp.jar    ant-commons-net.jar      ant-jmf.jar      ant-launcher.jar  ant.jar
ant-apache-bsf.jar    ant-apache-resolver.jar  ant-jai.jar              ant-jsch.jar     ant-netrexx.jar   ecj.jar
ant-apache-log4j.jar  ant-apache-xalan2.jar    ant-javamail.jar         ant-junit.jar    ant-swing.jar     jsch-0.1.50.jar

but this didn't help.

但这没有帮助。

com/jcraft/jsch/Logger.classfile is inside this JAR.

com/jcraft/jsch/Logger.class文件在这个 JAR 里面。

回答by Nicolas Lalevée

The way you try to fix the classpath is the way to do when using a standalone Ant. Here is it managed by Eclipse.

您尝试修复类路径的方式是使用独立 Ant 时的方式。这是由 Eclipse 管理的。

You can still contribute to the classpath of Ant. Just go into the Eclipse Preferences, in the Ant/Runtime entry, in the 'Classpath' tab. Use the button 'Add External Jars' to add your jsch.jar to Ant's classpath.

您仍然可以为 Ant 的类路径做出贡献。只需进入 Eclipse 首选项,在 Ant/Runtime 条目中,在“类路径”选项卡中。使用“添加外部罐子”按钮将您的 jsch.jar 添加到 Ant 的类路径。