Java包不存在
我开始处理遗留项目,现在正在努力在我的计算机上运行它。 我昨天导入了它,一切正常,项目确实构建了,每个人都很高兴。然后我必须安装一些额外的软件,并且在 java jdk 和 jre 路径方面遇到了一些问题,但我设法完成了该任务,然后我回到构建项目,但我无法做到这一点。我没有更改项目中的任何文件,也没有更改任何项目配置(我使用的是 eclipse 并使用 ant 构建),仅更改了系统环境。它还构建在其他团队成员环境中,因此它不是代码本身。
我收到的错误消息看起来像这样:
[javac] C:\Users\bilskluc\virtualdisk\blah\xyz\packages\radius\src\com\blah\wfc\radiusinput\RadiusHostEntry.java:9: package com.blah.devkit.exception does not exist
[javac] import com.blah.devkit.exception.DRException;
[javac] ^
[javac] C:\Users\bilskluc\virtualdisk\blah\xyz\packages\radius\src\com\blah\wfc\radiusinput\RadiusHostEntry.java:10: package com.blah.devkit.storable does not exist
[javac] import com.blah.devkit.storable.DRAbstractStorable;
[javac] ^
等等。当我从控制台运行它时,它在 eclipse 中看起来完全相同。使用的 ant 包与项目一起导入并明确指出,而且最重要的环境变量是在运行构建之前从配置文件设置的,并且配置文件没有更改。
提到的包和类位于项目中包含的 .jar 文件中。
有人遇到过类似的问题吗?我已经检查了我能想到的一切。为了降低我更改某些内容的风险,我删除了所有代码并再次从 svn 下载它(并检查最近几天没有提交)。
也许有人知道我应该在哪里寻找一些可能导致此问题的系统配置更改。
编辑
.classpath 文件中提到了这两个库
<classpathentry kind="lib" path="blah/lib/devkit.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/MZ-package-radius/blah/lib/devkit_javadoc.jar!/javadoc"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="blah/lib/picostart.jar"/>
,但我不太了解 ant,所以我不知道它是否使用此文件来确定类路径或是否使用任何其他设置
I am starting to work on legacy project and fighting now with running it on my computer.
I have imported it yesterday and everything worked fine, project did build and everyone was happy. Then I had to install some additional software and had some problems with java jdk and jre paths, but I managed to finish that task and I got back to building the project and I couldn't do it. I have not changed any file in the project, nor any project configuration (I'm using eclipse and build with ant) only changes in system environment were made. It also builds in other team member environment, so it's not the code itself.
error message I get looks like this:
[javac] C:\Users\bilskluc\virtualdisk\blah\xyz\packages\radius\src\com\blah\wfc\radiusinput\RadiusHostEntry.java:9: package com.blah.devkit.exception does not exist
[javac] import com.blah.devkit.exception.DRException;
[javac] ^
[javac] C:\Users\bilskluc\virtualdisk\blah\xyz\packages\radius\src\com\blah\wfc\radiusinput\RadiusHostEntry.java:10: package com.blah.devkit.storable does not exist
[javac] import com.blah.devkit.storable.DRAbstractStorable;
[javac] ^
and so on. It looks exactly the same in eclipse an when I run it from the console. ant packages used are imported with the project and pointed explicitly, also most important env variables are set from configuration file before running the build and the configuration file did not change.
Mentioned packages and classes are in a .jar file included in project.
Did anyone have a similar problem? I have checked everything I could think of. To reduce risk that I changed something I removed all code and download it from svn again (and checked that there were no commits in last few days).
Maybe someone has an idea where I should look for some system configuration changes that could cause this problem.
EDIT
those two libraries are mentioned in .classpath file
<classpathentry kind="lib" path="blah/lib/devkit.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/MZ-package-radius/blah/lib/devkit_javadoc.jar!/javadoc"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="blah/lib/picostart.jar"/>
but I don't know ant very well so I don't know if it uses this file to determine classpath or does it use any other setting
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设您在 ANT 脚本中设置了类路径:
您可以通过在目标中放入类似以下内容来输出 ANT 脚本使用的类路径:
Assuming you have your class path set up in your ANT script:
You can output the classpath being used by your ANT script by putting something like this inside your target:
我刚刚找到了一个适合我的解决方案。我的库位于“lib”目录中。奇怪的是,将它们移动到“libs”目录,将它们重新添加到 Eclipse 中的构建路径,然后更新 Ant 项目(
android update project --path .) 神奇地开始工作了。也许“libs”文件夹很特殊,它必须被准确命名?
I just figured out a solution that works for me. My libraries were in a "lib" directory. Oddly, moving them to a "libs" directory, re-adding them to the build path in Eclipse, and then updating the project for Ant (
android update project --path .
) magically started things working again. Perhaps the "libs" folder is special, and it has to be called exactly that?您可以将 jar 放入 build/jar/ 文件夹中,然后使用以下路径:
You can put your jars into build/jar/ folder and then use this path: