问题
I developed a Java Swing application on the NetBeans Platform (RCP). I want to include the Windows JRE with the installer that NetBeans generates in case a PC does not have JRE installed, but I do not know how to do this. I have tried to follow the following instructions but failed (I find that the instructions assume that you know absolutely everything on JDK and JRE, for example I would get the message 'pack200' is not recognized as an internal or external command...it would seem that some paths are wrong or outdated):
How to bundle JVM (JRE/JDK) in the installer bundle?
Including the JRE in a NetBeans Platform Installer
Installing the JRE via an Application's Installer via Windows
I am trying to pack the JRE version 7u7
My JDK folder structure is the following: C:\Program Files\Java\
in here I have the following two folders: jdk1.7.0_07 and jre7
Please help me...Thank you so much
回答1:
I have followed "Installing the JRE via an Application's Installer via Windows" in your link to successfully create a Windows installer for my Netbeans platform application. What are the problems you encountered?
"'pack200' is not recognized as an internal or external command" is because %JAVA_HOME%/bin is not in your PATH (environment variable). You can run pack200 with "C:\Program Files\Java\jdk1.7.0_07\bin\pack200" -J-Xmx1024m rt.jar.pack.gz rt.jar
Btw, it seems like "app.conf=nbproject/my.conf" part in the article is outdated. I have to modify directly the file "build/launcher/etc/app_name.conf" in my project.
回答2:
Maybe this guide can help you:
Self-Contained Applications: Package non-JavaFX application https://blogs.oracle.com/talkingjavadeployment/entry/packaging_improvements_in_jdk_7#3
One of popular questions people ask about self-contained applications - can i package my Java application as self-contained application? Absolutely. This is true even for tools shipped with JDK 7 update 6. Simply follow steps for creating package for Swing application with integrated JavaFX content and they will work even if your application does not use JavaFX.
来源:https://stackoverflow.com/questions/12976767/include-bundle-a-jre-within-the-netbeans-installer