简体   繁体   English

使用 Eclipse IDE 在 java 中设置类路径

[英]Setting the classpath in java using Eclipse IDE

I have an Eclipse project with an external folder containing a lot of JAR files (legacy libraries) .我有一个带有外部文件夹的 Eclipse 项目,其中包含许多 JAR 文件(遗留库)。 instead of adding all the jars in Eclipse ("add external Jar"), I would prefer to add a ref to this external folder.而不是在 Eclipse 中添加所有 jar(“添加外部 Jar”),我更愿意向这个外部文件夹添加一个引用。 In the "configure build bath", I'm adding a "External Class Folder".在“配置构建浴”中,我添加了一个“外部类文件夹”。 If I'm doing that instead of adding the Jar, my program is not compiling anymore.如果我这样做而不是添加 Jar,我的程序就不再编译了。 Am I missing something on the way I should use this option ?我在使用此选项的过程中是否遗漏了什么?

Thanks谢谢

Try this:尝试这个:

Project -> Properties -> Java Build Path -> Add Class Folder.项目 -> 属性 -> Java 构建路径 -> 添加类文件夹。

If it doesnt work, please be specific in what way your compilation fails, specifically post the error messages Eclipse returns, and i will know what to do about it.如果它不起作用,请具体说明您的编译失败的方式,具体发布 Eclipse 返回的错误消息,我将知道该怎么做。

You can create new User library,您可以创建新的用户库,

On

"Configure Build Paths" page -> Add Library -> User Library (on list) -> User Libraries Button (rigth side of page)

and create your library and (add Jars buttons) include your specific Jars.并创建您的库并(添加 Jars 按钮)包括您的特定 Jars。

I hope this can help you.我希望这可以帮助你。

刚刚遇到了同样的问题,对于那些有相同问题的人来说,可能是您将库放在模块路径而不是类路径上,同时将其添加到您的项目中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM