简体   繁体   English

Java Eclipse-如何更改类路径?

[英]Java Eclipse - How do I change the classpath?

I copied an Eclipse project from my PC (eclipse is on drive D) to the laptop (eclipse is on drive c) but when I try to deploy the agents I have in my project I keep getting the following error: 我将一个Eclipse项目从我的PC(Eclipse在驱动器D上)复制到了笔记本电脑(Eclipse在驱动器c上),但是当我尝试部署项目中包含的代理程序时,我不断遇到以下错误:

The archive **D**:/eclipse/plugins/it.fbk.sra.ejade_0.9.0/lib/libjade4/commons-codec-1.3.jar which is referenced by the classpath does not exist.

I changed all the libraries' addresses to the correct ones ( C:/eclipse/plugins/it.fbk.sra.ejade_0.9.0/lib/libjade4/__etc__ ) for all of them by right clicking the project > build path > configure build path... but that doesn't work. 我通过右键单击项目>构建路径>配置构建,将所有库的地址都更改为正确的库地址( C:/eclipse/plugins/it.fbk.sra.ejade_0.9.0/lib/libjade4/__etc__ )路径...但这不起作用。 I also tried to refresh the project, restart eclipse but still nothing.. 我也尝试过刷新项目,重新启动eclipse,但是还是没有。

Any suggestions? 有什么建议么?

Thanks a lot! 非常感谢!

I had the same problem and just discovered the solution to this. 我有同样的问题,只是找到了解决方案。

Go to project>properties>Java Build Path>Libraries>Add External JARS . 转到project>properties>Java Build Path>Libraries>Add External JARS

After specifying JAR file at a certain location, you will see it in previous window "JARs and class folders on the build path:" with "JAR_fileName - C:\\YOURPATH". 在特定位置指定JAR文件后,您将在上一个窗口“构建路径上的JAR和类文件夹:”中看到“ JAR_fileName-C:\\ YOURPATH”。

Don't stop here instead click on the "+" button to the left to expand it, and IF it says "Source attachment: (NONE)", you double click it and add the path to the JAR file by selecting Workspace location. 不要在这里停下来,而是单击左侧的“ +”按钮将其展开,如果它显示“源附件:(NONE)”,则双击它并通过选择Workspace位置将路径添加到JAR文件。

This solved the problem for me. 这为我解决了问题。

First make sure that the .jar file is exist in the given path,if so then you can easily try making a new project and copy your material to it, and configure it to the .jar path. 首先确保给定路径中存在.jar文件,如果是这样,则可以轻松地尝试制作一个新项目并将其材料复制到该项目中,然后将其配置为.jar路径。

If this doesn't work you may need to remove the temporary files from your project and eclipse on your laptop. 如果这不起作用,则可能需要从项目中删除临时文件,然后在笔记本电脑上使其黯然失色。

Also, please give more description about what happens on right clicking the project > build path > configure build path ? 另外,请提供更多有关右键单击project > build path > configure build path会发生什么的描述。

Hope everything works well. 希望一切顺利。

Had the same problem and non of the above solutions worked. 有相同的问题,以上解决方案均无效。

This is how I fixed it. 这就是我解决的方法。

  1. go to your project folder 转到您的项目文件夹
  2. open .classpath file (enable view hidden files if its not showing) 打开.classpath文件(如果未显示,则启用查看隐藏文件)
  3. edit the path 编辑路径
  4. delete the project from workspace. 从工作区中删除项目。 Imp: Don't select (Delete project content) checkbox when prompted. Imp:提示时,不要选中(删除项目内容)复选框。 !!!
  5. re-import the same project 重新导入同一项目

I had the same issue... I was refering jars from a mapped drive, when I moved them to my local drives, it started working fine. 我遇到了同样的问题...我从映射的驱动器引用了jar,当我将其移动到本地驱动器时,它开始正常工作。 Also try giving a shorte path for the jars. 也可以尝试给罐子一个短路的路径。

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

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