简体   繁体   English

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

[英]How to determine the minimum JRE version and system requirements for my Java application

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! 我使用Eclipse IDE用Java编写了一个应用程序,现在我需要知道运行应用程序所需的最小JRE版本! 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... 我知道某些方法只能在以后的JRE中使用,但我想知道找出我的应用程序最高要求的最简单方法是什么,所以任何建议都会受到赞赏......

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 - ie minimum amount of RAM... 另外,当我讨论要求的主题时,我将非常感谢任何建议或方法来确定我的软件的最低系统要求 - 即最小RAM量......

Thanks in advance 提前致谢

  • Method 1: For minimum JRE version, that's going to be tough. 方法1:对于最小的JRE版本,这将是艰难的。 The easiest way is to simply require the same version that you're building against, or later, eg JRE 6.xx or higher. 最简单的方法是简单地要求您正在构建的相同版本,或稍后,例如JRE 6.xx或更高版本。
  • 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. 方法2:安装多个JDK,使它们在Eclipse中可用,只需更改您正在构建的版本,每次运行应用程序的测试套件,并确保它们都通过。 The earliest version of the JDK that allows all your tests to pass is the lowest JRE it can run against. 允许所有测试通过的最早版本的JDK是它可以运行的最低JRE。 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. 只要有你的应用程序编译成功是不够的 ,因为JRE / JDK的早期版本可能有缺陷,允许进行成功的编译,但不允许进行适当的程序执行。
  • 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. 方法3:始终要求客户端上的最新版本,因为Oracle不断修补安全漏洞,最终,如果您有这种控制,最好在客户端需要最新版本。

As far as RAM, that's easy. 就RAM而言,这很容易。 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. 当JVM启动时,它会设置一个“最大”的RAM(我相信默认值可能是128MB),这是一个硬性限制,应用程序不会崩溃而不会崩溃。 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. 随着时间的推移分析您的应用程序,调整JVM上的内存设置,并找出您的应用程序运行所需的最小RAM量(a)具有可接受的性能,以及(b)不抛出OutOfMemoryError ,你已经完成了。

Ref: How to configure JVM options and memory? 参考: 如何配置JVM选项和内存?

For other requirements such as CPU req., things get a little fuzzier. 对于CPU req等其他要求,事情会变得更加模糊。 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. 有很多CPU,并且给定系统产生的吞吐量不仅可以根据CPU速度,而且还可以根据CPU速度,系统中安装的RAM数量,网络接口的速度而变化(如果你正在编写网络应用程序)和其他东西。 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". 对于这样的要求,你只需要在各种系统上进行测试,然后在某处绘制一条线,然后说:“如果你的硬件至少和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. 嗯,这些数据中常见的是系统特定的详细信息,如RAM,CPU,硬盘驱动器型号和其他硬件详细信息(您确定的任何数据与您的应用程序相关),以及性能日志记录数据。 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. 您可以对程序崩溃和错误执行相同的操作 - 将堆栈跟踪,系统信息和其他相关数据转储到发送回给您的日志文件中 - 当然, 只有当您的用户说可以发送时才那些数据还给你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM