2014-05-15 136 views
0

在我的Mac上,我試圖使用izpack創建安裝程序。每當我在終端中運行安裝程序(當然,我編譯後),它運行良好,並提示用戶在安裝結束時安裝最新的Java運行時。如果我只需單擊可運行的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="[email protected]"/> 
     <author name="Hidden Man" email="[email protected]"/> 
    </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

也許您已經安裝了JRE,因此在您的本地計算機上永遠不會執行「安裝後的JRE」掛鉤。

嘗試使用虛擬機(virtualbox超級方便,只需幾分鐘即可啓動新的Ubuntu桌面實例)在全新系統上測試您的安裝。

0

感謝您的建議。目前我在我的機器上運行1.7。我可以從終端運行DTRACE,在安裝程序內部有一個窗口顯示我所有的變量和檢查。 JRE的檢查返回true,所以我知道它正在工作。我的主要問題是我不知道什麼可能會導致我的bin文件從終端運行時運行,以及當通過查找程序啓動.jar時,它會阻止它運行。再次感謝我將嘗試虛擬框,看看是否清除任何東西。

相關問題