Can I install a file using Izpack 5 without it being part of the install.jar built by izpack

浪尽此生 提交于 2020-01-04 08:07:12

问题


My installation widget.zip zipfile contains the following:

  • 32bitJava
  • install.jar
  • widgetinstaller.exe
  • widgetinstaller.ini
  • widgetinstaller.ico

To summarize:

  • 32bitJava is a 32bit JRE downloaded from Oracle
  • install.jar is the installer created by Izpack
  • widgetinstaller.* are created by winrun4j providing an exe wrapper for the installer.

So with this setup I can install my application without user having to have a java runtime already installed.

However once installed the actual application also needs a java runtime to actually run. So at the moment a copy of 32bitJava is included as part of the izpack install, i.e it exists in install.jar and is installed at installation time.

But this means I have two copies of the JVM, and because the 32bitJava is larger than my actual application makes my download much too large.

So how can I copy the 32bitJava folder into the installation during/after installation instead of having to include it in install.jar ?


回答1:


You want to do a "loose" pack for the JVM. A loose pack doesn't need to contain the files it installs, so it could copy the file from the zip into place, instead of using one embedded in the jar.

<pack id="java" name="java" required="yes" preselected="yes" loose="true">
  ...
  <executable ...>
    <!-- something appropriate to install java -->
  </executable>
</pack>



回答2:


Pack the files into a self-extracting archive/zip, and as part of the unzip process, have the files extracted to the location you need them to be.

There is more information about self-extracting archives at Wikipedia: http://en.wikipedia.org/wiki/Self-extracting_archive




回答3:


Instead of being forced to include the java installation in the install.jar, why don't you just have the install.jar install your program and include a link here: http://www.java.com/inc/BrowserRedirect1.jsp?locale=en ? That is the link to download the current version of java.

To create such a link, right click > new > shortcut, paste in the link into the first dialogue box, click next, then name it "Java Installation". This would add 4 kb at most to your package, and still allow you to install java (however, the user will have to click this manually)

I am using the browser redirect URL because it identifies what java people need based on thier computer (OS and processor bit)




回答4:


How about creating a small, post-installation utility to copy the executable to the location? You could create it in a small shell script (or batch file on Windows) or even a little C++ utility that simply copies the JVM to the location you need. This way, after you install the utility, you then trigger the post-installation code, and copy the JVM over to the desired location.



来源:https://stackoverflow.com/questions/12516240/can-i-install-a-file-using-izpack-5-without-it-being-part-of-the-install-jar-bui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!