Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
366 views
in Technique[技术] by (71.8m points)

installation - Stripping the JRE to be bundled with an application - what can I omit?

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:

The files that make up the Java SE Runtime Environment are divided into two categories: required and optional. Optional files may be excluded from redistributions of the Java SE Runtime Environment at the vendor's discretion.

The following section contains a list of the files and directories that may optionally be omitted from redistributions with the Java SE Runtime Environment. All files not in these lists of optional files must be included in redistributions of the runtime environment.

...When redistributing the JRE on Microsoft Windows as a private application runtime (not accessible by other applications) with a custom launcher, the following files are also optional. These are libraries and executables that are used for Java support in Internet Explorer and Mozilla family browsers; these files are not needed in a private JRE redistribution.

What puzzles me is that the list of optional files includes, among others:

binjava.exe
binjavaw.exe
binjavaws.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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When redistributing the JRE on Microsoft Windows as a private application runtime (not accessible by other applications) with a custom launcher, the following files are also optional.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...