Netbeans 6.8:Lib-Import 可以工作,但“包不存在”编译时

发布于 2024-09-06 02:59:51 字数 378 浏览 0 评论 0原文

我正在开发一个 JavaME 项目,需要导入外部库,这些库可以作为 jar 文件提供给我。所以我选择了项目属性->图书馆和资源->添加 Jar/Zip 并在那里添加 jar 文件。

编辑代码时,一切正常。我可以从该库导入类并按预期使用它们。但是当我尝试编译该项目时,我收到错误......

包<包名>;不存在

该行

...

导入<包名>.<类名>;

就像我说的,编辑代码时不会出现错误或警告。该库正确显示在“资源”下的项目视图中,并且 Netbeans 自动完成功能也正常工作。该错误仅在编译时出现。

I'm working on a JavaME project and need to import external libraries, which are available to me as jar files. So I selected the project properties -> libraries & resources -> add Jar/Zip and added the jar file there.

When editing the code, everything works. I can import the classes from this library and use them as expected. But when I try to compile the project, I'm getting the error...

package <packagename> does not exist

...at the line

import <packagename>.<classname>;

Like I said, no error or warning shows up when editing the code. The library is correctly shown in the project view under "Resources" and the Netbeans autocomplete works as well. The error occurs only when compiling.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹤舞 2024-09-13 02:59:51

有时,ant 脚本 (nbproject/build-impl.xml) 会与项目 (nbproject/project.properties) 不同步。通过对项目进行另一次更改以鼓励 NB 重写 ant 脚本,可以轻松解决此问题。

打开项目属性对话框(文件 > 项目属性)并选择编译。切换保存时编译的状态。单击OK关闭对话框并重写ant脚本。请稍等片刻,确保它没有忙于扫描项目(状态显示在右下角)。然后再次打开对话框并切换回值。关闭对话框并再次尝试编译。

Once in a while the ant script (nbproject/build-impl.xml) will get out of sync with the project (nbproject/project.properties). This is easily fixed by makinga another change to the project to encourage NB to rewrite the ant script.

Open the project properties dialog (File > Project properties) and select Compiling. Toggle the state of Compile on Save. Click OK to close the dialog and rewrite the ant script. Give it a moment to be sure it's not busy scanning the project (Status displayed in the bottom right.) Then open the dialog again and toggle the value back. Close the dialog and try compiling again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文