Netbeans 6.8:Lib-Import 可以工作,但“包不存在”编译时
我正在开发一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有时,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 ofCompile on Save
. ClickOK
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.