Blackberry Java 运行时缺少一点?
据我了解,Blackberry Java Runtime 运行 micro-java 运行时。
它基于Java 1.3。 (感谢 Andreas_D)
Blackberry 提供了一些替代方案,或者 micro-java 提供了一些替代方案。
但这真是太痛苦了。我们有一个使用android java的应用程序,它支持完整的Java 1.6。我们本来希望对 UI 组件进行转换,但现在必须重写代码?
有没有一种简单的方法可以解决这个问题?
例如,我无法获取 java.io.File
。它不是唯一的..
是否有替代方案:
java.io.RandomAccessFile
java.io.File
java.io.FileOutputStream
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是不是少了一点?是的,如果您将其与完整的 Java SE / EE 实现进行比较。如果您将其与 Java ME 参考实现进行比较,则不会。
Java ME (J2ME) 并不包含您在完整的 Java SE 平台中可能期望的所有 API 类 - 它从来都不是有意的。此外,移动设备需要能够向应用程序等授予和撤销特定权限。
请记住,这是为资源有限的设备特意设置的子集,并且遗漏的情况都有详细记录。例如,Java ME 中的文件访问是通过文件连接 api 完成的:
文件连接 API< /a>
另请参阅这些站点(了解其他/一般差异):
Java SE、EE 和ME
Android 和 Java ME 开发之间的区别
J2ME JVM 编程与 J2SE JVM 编程之间的差异
Java ME 维基百科页面
Java ME CLDC - 维基百科上值得注意的限制列表
Missing a bit? Yes if you're comparing it to a full Java SE / EE implementation. No if you're comparing it against the Java ME reference implementation.
Java ME (J2ME) doesn't contain all the API classes you may expect in a full Java SE platform - it was never intended to. Also, mobile devices need to be able to grant and revoke specific permissions to applications etc.
Remember it's a deliberate subset for devices with limited resources and the omissions are pretty well documented. For example, file access in Java ME is done via file connection api:
File Connection API
Also see these sites (for other/general differences):
Differences between Java SE, EE and ME
Difference between Android and Java ME development
Differences between programming for a J2ME JVM, and programming for a J2SE JVM
Java ME Wikipedia Page
Java ME CLDC - Noteworthy limitations list at Wikipedia
Blackberry 支持 Java 1.3,而不是 1.4。
解决那些缺失的文件相关类的最简洁方法是编写一些包装类,这些类仅公开您需要的功能,然后您可以使用通过 J2ME 和 BlackBerry API 提供的任何内容来编写 BlackBerry 的实现。
或者,您可以为 BlackBerry 编写您自己的
java.io.File
版本,并将它们包含在您的项目中。如果您采用这种方法,您需要非常小心地准确地模仿该行为,否则您可能会面临一个充满痛苦错误的全新世界。很可能有黑莓的图书馆可以满足您的需求,我将让您自行谷歌搜索......
Blackberry supports Java 1.3, not 1.4.
The cleanest way to get around those missing File-related classes would be to write some wrapper classes which just expose the functionality you need, then you can write implementations for BlackBerry using whatever's available via the J2ME and BlackBerry APIs.
Alternatively, you could just write your own versions of
java.io.File
etc for BlackBerry, and include those in your project. If you take this approach you'll need to be very careful to mimic the behaviour exactly or you could be opening yourself up to a whole new world of painful bugs.There may well be libraries out there for BlackBerry which do what you want, I'll leave it up to you to do some googling on that...