更改 MIDlet 名称或供应商属性时出现 JavaME NullPointerException(Eclipse + Series 40 模拟器)

发布于 2024-09-12 09:05:29 字数 669 浏览 1 评论 0原文

我有一个名为 Numbers 的 MIDlet 项目,我决定将其重命名为 Digits。我决定从头开始创建一个全新的项目,而不是简单地重命名它,这样我就可以拥有新的目录、包名称、.jad/.jar 名称等。一切都很顺利,我将 .java 文件复制到 /src和资源文件到/res并重新编译成功。我在这两个项目中使用了 Eclipse Helios 和诺基亚的 Series 40 第 5 版 SDK,Feature Pack 1。

现在,由于某种奇怪的原因,当 MIDlet 在模拟器中启动时,它会抛出 NullPointerException,但不是在启动时立即抛出,而是在启动屏幕(这是一个游戏)之后抛出。我根本没有接触过代码,所以我排除了代码中出现异常的可能性,因为当项目被称为 Numbers 时它工作得很好。经过一个小时的反复试验,我发现了一件奇怪的事情:如果我打开应用程序描述符并将 MIDlet name 属性从“Digits”更改为“Numbers”(旧项目名称),则一切都会运行完美,没有抛出异常。

我在所有项目文件中进行了文本搜索,并且单词“Numbers”仅出现在应用程序描述符和 .jad 文件中,并且仅在我更改 MIDlet 名称属性之后出现,否则该字符串将无处可寻(没有类名,没有变量,没有其他属性,代码和项目中都没有字符串“Numbers”)。该参考来自哪里? Eclipse 或 Series 40 模拟器中存在错误?什么给?

I had a MIDlet project called Numbers that I decided to rename to Digits. Instead of simply renaming it, I decided to create a brand new project from scratch, so that I can have new directory, package name, .jad/.jar names, etc. Everything went fine, I copied the .java files to /src and resource files to /res and recompiled successfully. I used Eclipse Helios and Nokia's Series 40 5th Edition SDK, Feature Pack 1, for both projects.

Now, for some weird reason when the MIDlet starts in the emulator, it throws a NullPointerException, but not immediately on startup, but after a splash screen (it's a game). I haven't touched the code at all, so I rule out the possibility of an exception in the code, since it worked just fine when the project was called Numbers. After an hour of trial and error, I found a weird thing: if I open up the Application Descriptor and change the MIDlet name property from "Digits" to "Numbers" (old project name), everything runs perfectly and no exception is thrown.

I did a text search in all project files and the word "Numbers" only appears in the Application Descriptor and the .jad file, and only after I change the MIDlet name property, otherwise that string is nowhere to be found (no class names, no variables, no other properties, neither in the code nor in the project have a string "Numbers"). Where is that reference coming from? A bug in Eclipse or Series 40 emulator? What gives?

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

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

发布评论

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

评论(1

痴情 2024-09-19 09:05:29

又查了半个小时才找到。 Series 40 SDK 目录中有一个文件夹,它显然缓存了它运行的 MIDlet,并且还保留了同一 MIDlet 的旧版本。我清理了整个目录,现在项目开始正常,并使用 MIDlet NameMIDlet Vendor 中的新值。要清理的目录是:
诺基亚\Devices\S40_5th_Edition_SDK_Feature_Pack_1\bin\Storage\6500500\C\DirectLoaded\

Found, after another half an hour of investigation. There's a folder in the Series 40 SDK directory that apparently caches the MIDlets it runs, and keeps older versions of the same MIDlet there too. I cleaned the entire directory and now the project starts just fine with new values in MIDlet Name and MIDlet Vendor. The directory to clean is:
Nokia\Devices\S40_5th_Edition_SDK_Feature_Pack_1\bin\Storage\6500500\C\DirectLoaded\

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