问题描述
我一直在将JRE与我的应用程序捆绑在一起,只需将文件从 $ JAVA_HOME / jre
复制到我的应用程序的发行版。这可能违背了Java的精神,但它通过确保我的应用程序在经过测试的JRE版本上运行来减少潜在问题(包括比特;我使用一些JNI,它要求JRE是32位版本)。
它工作正常,但整个发行版有点大,所以可能会遗漏一些不必要的文件?实际上, $ JAVA_HOME / jre / README.txt
包含以下建议:
令我感到困惑的是,可选文件列表包括,其中:
bin\java.exe
bin\javaw.exe
bin \ javaws.exe
如何 java / javaw.exe
是可选的吗?如果没有它们我应该如何启动Java应用程序?显然我不知道某些事情(很可能),或说明是完全错误的。
如果在自己的应用程序中嵌入JVM(通过链接其共享库),则不需要独立的启动程序可执行文件。我认为Eclipse就是这样工作的。例如。
如果你的应用程序使用java可执行文件(例如通过批处理文件),那么你当然需要它们。 / p>
I've been bundling JRE with my app by simply copying the files from $JAVA_HOME/jre
to my app's distribution. This may be against the spirit of Java, but it reduces potential problems by ensuring that my app runs on a version of JRE that it was tested on (including the bitness; I use some JNI which requires that the JRE is a 32-bit version).
It works fine, but the whole distribution is somewhat big, so maybe some unnecessary files could be left out? Indeed, $JAVA_HOME/jre/README.txt
contains the following advice:
What puzzles me is that the list of optional files includes, among others:
bin\java.exe
bin\javaw.exe
bin\javaws.exe
How can java/javaw.exe
be optional? How am I supposed to start a Java application without them? Apparently I don't know something (likely), or the instructions are simply wrong.
If you embed the JVM (by linking against its shared libraries) in your own application, you do not need the standalone launcher executables. I think Eclipse works that way, for example.
If your app uses the java executable (via a batch file for example), then you need them, of course.
这篇关于剥离JRE以与应用程序捆绑在一起 - 我可以省略什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!