J2SE 和 Java DB

发布于 2024-10-04 05:40:53 字数 392 浏览 0 评论 0 原文

你好,

我的Java经验有限,但我对它有足够的了解。考虑到这一点,我尝试编写一个带有独立数据库(Java DB)的移动应用程序,以维护我的健身日志。

Netbeans 是我首选的 IDE,它目前是最新的稳定版本,并且安装了 Java DB——实际上数据库已经准备好并正在等待——但我就是不知道如何将 Java DB 连接到 J2SE 项目。

通过搜索教程和非在线内容,我找到了带有独立数据库的 Java 桌面应用程序,当我尝试将导入语句移植到 J2SE 项目时,除了导入错误之外什么也没有收到 - 即使添加了 Java DB jar文件到项目库。

任何帮助或正确方向的指出将不胜感激。另外,我并不热衷于使用 Java DB,因此,如果使用其他可移植数据库更可取,那么我愿意接受建议。

谢谢

Greetings,

My Java experience is limited, but I have a fair enough understanding of it. With that in mind, I am attempting to write a mobile application with a self-contained database -- Java DB -- for the purpose of maintaining my fitness log.

Netbeans is my preferred IDE, and it is currently of the latest stable version and Java DB is installed -- indeed the database is ready and waiting -- but I simply cannot figure out how to attach a Java DB to a J2SE project.

Searching for tutorials and what not online lead me to Java Desktop Applications w/ a self-contained database, and when I attempt to port the import statements to a J2SE project, I receive nothing but import errors -- even with adding the Java DB jar files to the project library.

Any assistance or point in the right direction would be greatly appreciated. Also, I am not deadset on the use of Java DB, and so if another portable database is preferable, then I am open to suggestions.

Thank you

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

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

发布评论

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

评论(4

微凉 2024-10-11 05:40:53

J2SE 与 J2ME 有很大不同。 J2ME 包含一个精简的VM,并且没有许多您通常在J2SE 中找到的功能(例如泛型、迭代器、集合、反射、终结、线程组、JNI)。

J2ME 不是用于记录大量信息并尝试将其显示在信息图表中的平台。典型的 MIDlet 可以存储大约 2MB 的信息,尽管这因设备而异并且不是一个确定的数字。

J2ME 是为内存较小的设备设计的,因此它的最大堆大小较小。这意味着您在尝试显示超过一个月的详细健身信息时很可能会耗尽内存。

J2ME 图形 API 的数量有限,并且由于平台的限制,它们都无法以您在 J2SE 中期望的方式显示图形。

正如另一个人提到的,J2ME 使用 RecordStore 保存信息。它只能存储字节数组,这通常意味着您开始编写自己的非常轻的序列化框架来存储对象。每个要序列化的对象都实现了 toByerArray() 和 fromByteArray(byte []) 接口。但是,您可以使用其他框架来为您序列化对象。

J2SE is very different to J2ME. J2ME contains a cut down VM and does not have many of the features (e.g. generics, iterators, collections, reflection, finalization, thread groups, JNI ) that you would normally find in J2SE.

J2ME is not the platform to use for logging lots of information and trying to display it in informative graphs. A typical MIDlet can store around 2MB of information, although this varies between devices and is not a definitive number.

J2ME was designed for devices with little memory, so it has a small max heap size. This means that you would most likely run out of memory trying to display over a months worth of detailed fitness information.

There are a limited number of J2ME graphing APIs and because of the limitations of the platform, none of them can display graphs in a manner you'd expect in J2SE.

As another person mentioned J2ME uses a RecordStore to persist information. It can only store byte arrays which normally means you start writing your own very light serialisation framework for storing objects. Where every object you want to serialize implements a toByerArray() and fromByteArray(byte []) interface. However you can use other frameworks which will serialize objects for you.

孤云独去闲 2024-10-11 05:40:53

如果您正在考虑编写在 MIDP 平台上运行的应用程序,您将会非常失望,因为 JavaDB 无法在 MIDP 上运行。 J2SE != MIDP 无论如何。

If you're thinking of writing your app to run on the MIDP platform, you'll be sorely disappointed because JavaDB won't work on MIDP. J2SE != MIDP by any stretch.

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