在我的Mac上,我正在尝试使用izpack创建安装程序。每当我在终端中运行安装程序(在编译当然)之后,它运行正常,并提示用户在安装结束时安装最新的Java运行时。如果我只是单击runnable installer.jar,安装程序永远不会尝试运行bin文件。我错过了什么?
这是我的安装xml的副本
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<!--
The info section.
The meaning of the tags should be natural ...
-->
<info>
<appname>Beldon Workbench</appname>
<appversion>0.1 Beta</appversion>
<authors>
<author name="JPz" email="jpz@superman.org"/>
<author name="Hidden Man" email="hidden@hisdomain.com"/>
</authors>
<url>http://www.anotherworld-inspace-website.net/</url>
</info>
<!--
The gui preferences indication.
Sets the installer window to 640x480. It will not be able to change the size.
-->
<guiprefs width="640" height="480" resizable="yes"/>
<!--
The locale section.
Asks here to include the English and French langpacks.
-->
<locale>
<langpack iso3="eng"/>
<langpack iso3="fra"/>
</locale>
<conditions>
<!-- checks that the correct JRE version is installed on the windows machine -->
<condition type="java" id="jre.version">
<java>
<class>CheckVersion.Check</class>
<field>isCorrectVersion</field>
</java>
<returnvalue type="boolean">true</returnvalue>
</condition>
<!-- condtion checks for windows needing updated jre -->
<condition type="and" id="jre.windows.install">
<condition type="ref" refid="jre.version"/>
<condition type="ref" refid="izpack.windowsinstall" />
</condition>
<!-- condition checks for mac needing updated jre -->
<condition type="and" id="jre.mac.install">
<condition type="ref" refid="jre.version" />
<condition type="ref" refid="izpack.macinstall" />
</condition>
</conditions>
<!--
The resources section.
The ids must be these ones if you want to use the LicencePanel and/or the InfoPanel.
<resources>
<res id="LicencePanel.licence" src="Licence.txt"/>
<res id="InfoPanel.info" src="Readme.txt"/>
</resources>
-->
<!--
The panels section.
We indicate here which panels we want to use. The order will be respected.
-->
<panels>
<panel classname="HelloPanel"/>
<panel classname="TargetPanel"/>
<panel classname="PacksPanel"/>
<panel classname="InstallPanel"/>
<panel classname="FinishPanel"/>
</panels>
<!--
The packs section.
We specify here our packs.
-->
<packs>
<!-- Core Java files- i.e. class files -->
<pack name="Core" required="yes" override="asktrue">
<description>Core Application Files</description>
<fileset dir="../../../Users/homemac/Documents/Beldon/WorkbenchTest/core" targetdir="$INSTALL_PATH/core"/>
<!-- installs jre8 if needed on windows machine -->
<executable targetfile="jre8.exe" stage="postinstall" failure="warn" condition="jre.windows.install" />
<!-- installs jre8 if needed on a mac machine -->
<executable type="bin" targetfile="/Applications/IzPack/bin/script/installjreMac.bin" stage="postinstall" failure="warn" condition="jre.mac.install" keep="true" />
</pack>
<!-- Database folder for comparison tables (updates) -->
<pack name="DB" required="yes">
<description>Database Files</description>
<fileset dir="../../../Users/homemac/Documents/Beldon/WorkbenchTest/db" targetdir="$INSTALL_PATH/db"/>
</pack>
<!-- 3rd Party Libraries -->
<pack name="libs" required="yes">
<description>3rd party libraries</description>
<fileset dir="../../../Users/homemac/Documents/Beldon/WorkbenchTest/libs" targetdir="$INSTALL_PATH/libs"/>
</pack>
<!-- Cache folder for holding update files -->
<pack name="cache" required="yes">
<description>Temporary Update Files</description>
<fileset dir="../../../Users/homemac/Documents/Beldon/WorkbenchTest/cache" targetdir="$INSTALL_PATH/cache"/>
</pack>
<!-- Log files folder -->
<pack name="logs" required="yes">
<description>Log Files</description>
<fileset dir="../../../Users/homemac/Documents/Beldon/WorkbenchTest/logs" targetdir="$INSTALL_PATH/logs"/>
</pack>
</packs>
<jar src="../lib/CheckVersion.jar"/>
这是我的java类的副本,用于检查最新版本
public class Check {
public static boolean isCorrectVersion = checkVersion();
public static boolean checkVersion() {
boolean property = false;
Properties p = System.getProperties();
String ver = p.getProperty("java.version");
System.out.println(ver);
Pattern ptn = Pattern.compile("^([1-2]{1}\\.\\d+){1}.*$");
Matcher m = ptn.matcher(ver);
m.find();
System.out.println(m.group(1));
//double v = 1.8;
if(Double.parseDouble(m.group(1)) < 1.8) {
property = true;
}
return property;
}
}
答案 0 :(得分:0)
也许你已经安装了JRE,因此在安装了JRE之后就已经安装了JRE&#34;挂钩永远不会在您的本地计算机上执行。
尝试使用虚拟机(虚拟机非常方便,只需几分钟即可启动新的ubuntu桌面实例),以便在新系统上测试您的安装。
答案 1 :(得分:0)
感谢您的建议。目前我在我的机器上运行1.7。我可以从终端运行DTRACE,在安装程序内部有一个窗口显示我的所有变量和检查。检查JRE返回true,所以我知道它正在工作。我的主要问题是我不知道从终端运行时可能导致我的bin文件运行的原因以及当通过finder启动.jar时会阻止它运行的原因。再次感谢我将尝试虚拟框以查看是否清除了任何内容。