为什么不能找到的NetBeans我的一些项目CopyLibs? [英] Why can't NetBeans find CopyLibs for some of my projects?

查看:252
本文介绍了为什么不能找到的NetBeans我的一些项目CopyLibs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天早上,成本好几个小时试图追查下来跑进一个讨厌的问题。我继承了一些code两个项目的NetBeans, A B 。的他们都构建和运行成功的;没有复杂的Ant构建任务;只是默认IDE设置。

I ran into a nasty issue this morning that cost me several hours trying to trace it down. I had inherited some code with two NetBeans projects, A and B. They both build and run successfully; there are no complicated Ant build tasks; just the default IDE setup.

这两个项目共享大量code,所以我分解出来进入一个新的,第三个项目,通用。解析引用等之后,NetBeans的报告没有任何错误。一切似乎都很好。我建通用项目顺利进行。然后,事情变得怪异。

These two projects share a large amount of code, so I factored it out into a new, third project, Common. After resolving references and so on, NetBeans reports no errors. Everything seems fine. I build the Common project without a hitch. Then things get weird.

突然,当我尝试建立项目 A B ,它们编译的就好了 - 但在年底的建立的,每一个都打破了同样的错误:

Suddenly, when I try to build projects A and B, they compile just fine--but at the end of the build, each one breaks with the same error:

Copying 1 file to C:\Projects\projectName\build
C:\Projects\projectName\nbproject\build-impl.xml:723: The following error occurred while executing this line:
C:\Projects\projectName\nbproject\build-impl.xml:543: taskdef class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs cannot be found
 using the classloader AntClassLoader[]
BUILD FAILED (total time: 3 seconds)

所有的.class 文件显示在建立/班,一切似乎都进展顺利,但没有什么使得它在 DIST 文件夹中。所以我开始寻找 CopyLibs 的问题。

All the .class files show up in build/classes, and everything else seems to have gone smoothly, but nothing makes it to the dist folder. So begins my search for CopyLibs issues.

人建议确保 ORG-的NetBeans模块-java的j2seproject-copylibstask.jar 是在 project.properties 文件(这是),并在< USERHOME方式> /的NetBeans /版本/ build.properties 文件以及(这是)。该库的确实的存在,它被引用的所有场所;其实NetBeans的似乎这个罐子的副本放入 ./的lib 所有Java项目默认文件夹中。我试图使全新的项目,使源手动,无济于事。我感到迷惑。

People suggested making sure that org-netbeans-modules-java-j2seproject-copylibstask.jar was referenced correctly in the project.properties file (it was), and in the <userhome>/.netbeans/version/build.properties file as well (it was). The library does exist at all the places it is referenced; in fact NetBeans seems to place a copy of this jar into the ./lib folder of all Java projects by default. I tried making brand-new projects and bringing the sources in manually, to no avail. I was mystified.

我张贴在这里的希望,


  • 也许有人可以给我一些见解这是怎么发生摆在首位,以及如何避免它。

  • 也许有人可以告诉我的为什么只有某些项目突破,即使所有具有完全相同的 project.properties 文件或者是全新的。

  • 在将来这个问题的人将有一个更好的时间。

  • Maybe someone can give me some insight into how this happened in the first place and how to avoid it.
  • Maybe someone can tell me why only certain projects break, even when all have exactly the same project.properties file or are brand new.
  • People with this problem in the future will have a better time of it.

推荐答案

我能在网上找到的最接近修复的此链接,只包括部分解决方案。继在该职位说明书的不会的解决这个问题,因为它忽略了一些重要的东西。下面是我最终偶然发现了解决方案。

The closest fix I could find online is this link, which only includes a partial solution. Following the instructions in that post will not fix the problem, because it leaves out some important stuff. Here's the solution that I eventually stumbled upon.

在NetBeans中,去这里:

In NetBeans, go here:

Tools > Options > Miscellaneous > Ant

在窗口的底部,有一个标箱属性。粘贴以下内容:

libs.CopyLibs.classpath=C\:\\Program Files\\NetBeans 7.1\\java\\ant\\extra\\org-netbeans-modules-java-j2seproject-copylibstask.jar

替换的NetBeans 7.1 与您的实际安装路径。这实际上是所有有给它!这使得它非常棘手的事情是,NetBeans的,当你点击确定用来做该领域的文本的某些分析。具体来说,它把反斜杠作为转义,也有时会添加反斜杠

Replace NetBeans 7.1 with your actual install path. That's actually all there is to it! The thing that makes it tricky is that NetBeans appears to do some parsing of the text in this field when you click OK. Specifically, it treats backslashes as escapes, and also sometimes adds backslashes.

这就是为什么我花了这么长时间才找到:我想在链接的解决方案(如 C:\\ Program Files文件\\ Netbeans的等),它没将不起作用,但后来我回到这个窗口来发现这一点:ç\\:哦!程序文件等。我想,我只是输入错了!傻瓜,我什么!所以我纠正它 C:\\ 并试图again--仍然没有成功。原来NetBeans将的添加的反斜杠逃逸,而只是删除任何其他单反斜线找到这里。

This is why it took me so long to find: I tried the solution in the link (e.g. C:\Program Files\Netbeans etc), and it didn't work, but later I came back to this window to discover this: C\:Program Files etc. "Oh!" I thought, "I just typed it wrong! What a fool I am!" So I "corrected" it to C:\ and tried again-- still no success. Turns out NetBeans will add a backslash to escape :, but will just delete any other single-backslashes it finds in here.

我仍然不知道为什么会这样摆在首位,为什么似乎只影响某些项目。

这篇关于为什么不能找到的NetBeans我的一些项目CopyLibs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆