如何确定 Java 应用程序的最低 JRE 版本和系统要求

发布于 2024-12-19 14:27:48 字数 215 浏览 3 评论 0原文

我已经使用 Eclipse IDE 用 Ja​​va 编写了一个应用程序,现在我需要知道运行该应用程序所需的最低 JRE 版本!我知道某些方法仅在以后的 JRE 下可用,但我想知道找出应用程序的最高要求的最简单方法是什么,因此任何建议将不胜感激......

此外,当我谈论要求主题时,我将不胜感激任何建议或方法来确定我的软件的最低系统要求 - 即最小 RAM 量......

提前致谢

I have written an application in Java using Eclipse IDE and I now need to know the minimum JRE version that is required to run the application! I know that certain methods are only available under later JREs, but I was wondering what the easiest way to find out the highest requirement of my application would be, so any suggestions would be appreciated...

Also whilst I am on the topic of requirements, I would appreciate any advice or methods for determining the minimum system requirements for my software in general - i.e minimum amount of RAM...

Thanks in advance

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

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

发布评论

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

评论(1

鹿港小镇 2024-12-26 14:27:48
  • 方法 1: 对于最低 JRE 版本,这将是困难的。最简单的方法是只需要与您构建的版本相同或更高版本,例如 JRE 6.xx 或更高版本。
  • 方法 2: 安装多个 JDK,使它们在 Eclipse 中可用,然后只需更改您正在构建的版本,每次运行应用程序的测试套件,并确保它们全部通过。允许所有测试通过的最早版本的 JDK 是它可以运行的最低版本的 JRE。 仅仅成功编译您的应用程序是不够的,因为以前版本的 JRE/JDK 可能存在允许成功编译的错误,但不允许允许正确的程序执行。
  • 方法 3: 始终在客户端要求最新版本,因为 Oracle 会不断修补安全漏洞,最终,如果您有这种控制能力,最好在客户端要求最新版本。客户端。

就 RAM 而言,这很简单。当 JVM 启动时,它会设置一个“最大”RAM 量(我相信默认值可能是 128MB),这是一个硬性限制,您的应用程序不能超过它而不崩溃。随着时间的推移分析您的应用程序,调整 JVM 上的内存设置,并找出您的应用程序运行 (a) 具有可接受的性能和 (b) 不引发 < 的情况所需的最小 RAM 量。 a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/OutOfMemoryError.html" rel="noreferrer">OutOfMemoryError,就完成了。

参考:如何配置 JVM 选项和内存?

对于其他要求例如 CPU 要求,事情变得有点模糊。有很多 CPU,给定系统产生的吞吐量不仅取决于 CPU 速度,还取决于硬盘驱动器的速度、系统中安装的 RAM 量、网络接口的速度(如果您正在编写网络应用程序),以及其他事情。对于诸如此类的要求,您只需在各种系统上进行测试,然后在某处划一条线,然后说:“如果您拥有至少与 X、Y 一样强大的硬件,那么您可以期望获得可接受的性能,Z”。

您可以做的另一件事是构建基准测试或某种性能日志记录,并将性能数据发送回给您。很多应用程序都这样做。你知道“我们可以将匿名使用数据发送回母舰吗?”您在安装某些软件时遇到的问题?这些数据中常见的是特定于系统的详细信息,例如 RAM、CPU、硬盘驱动器型号和其他硬件详细信息(您确定与应用程序相关的任何数据)以及性能日志记录数据。通过采用这种方法,您可以获得来自许多不同系统配置的大量性能数据,而无需内部拥有大量不同配置的机器。

您可以对程序崩溃和错误执行相同的操作 - 将堆栈跟踪、系统信息和其他相关数据转储到发送回给您的日志文件中 - 但当然,只有当您的用户说它是好的将该数据发送回给您。

  • Method 1: For minimum JRE version, that's going to be tough. The easiest way is to simply require the same version that you're building against, or later, e.g. JRE 6.x.x or higher.
  • Method 2: Install multiple JDK's, making them available in Eclipse, and just change the version you're building against, running your app's test suite each time, and making sure they all pass. The earliest version of the JDK that allows all your tests to pass is the lowest JRE it can run against. Simply having your app successfully compile isn't enough, because previous versions of the JRE/JDK might have bugs that allow for successful compilation, but don't allow for proper program execution.
  • Method 3: Always require the latest on the client side, because Oracle is constantly patching security holes, and ultimately, it may be best to require the latest versions, if you have that kind of control, on the client side.

As far as RAM, that's easy. When the JVM starts it sets a 'maximum' amount of RAM (I believe the default may be 128MB), and that's a hard limit that your application cannot exceed without crashing. Profile your app over time, tweaking the memory settings on the JVM, and find out what the minimum amount of RAM is that you'll need for your app to run both (a) with acceptable performance, and (b) without throwing an OutOfMemoryError, and you're done.

Ref: How to configure JVM options and memory?

For other requirements such as CPU req., things get a little fuzzier. There are a lot of CPUs out there, and the throughput that a given system produces can vary not just based on CPU speed, but the speed of the hard drive, the amount of RAM installed in the system, the speed of the network interface (if you're writing a network app), and other things. For requirements such as that, you'll want to just test it on a variety of systems and sort of draw a line somewhere, and say, "You can expect acceptable performance if you have hardware that is at least as powerful as X, Y, Z".

The other thing you could do is build in a benchmark, or some kind of performance logging, and have that performance data sent back to you. Lots of apps do this. You know that "May we send anonymous usage data back to the mothership?" question you get when installing some software? Well, common among that data are system-specific details such as RAM, CPU, hard drive model, and other hardware details (whatever data you determine is relevant to your app), along with performance logging data. By taking that kind of approach, what you get is a lot of performance data from lots of different system configurations without needing to have a huge number of differently configured machines in-house.

You can do the same thing for program crashes and bugs - have the stack traces, system info, and other relevant data dumped to a log file that is sent back to you - but of course, only if your users have said it's okay to send that data back to you.

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