我還沒有測試過這個,但經過一番搜索後,我發現了什麼。
Packaging a Java App for Distribution on a Mac指南爲您提供了關於如何捆綁應用程序的基本信息(它聽起來像您已經得到的)。從那裏我按照docs for app bundler,在那個頁面的「運行時」你看到你可以明確包含或排除捆綁文件/文件夾。
根據他們的文檔
"By default, only the contents of the jre/ directory will be included with the bundled application. All executable content (i.e. bin/, jre/bin/) is excluded. Additional content can be included or excluded using nested <include> and <exclude> elements, respectively."
,從我把他們的示例代碼,並增加了排除語句:
<-- Import environment variables -->
<property environment="env"/>
<-- Define the appbundler task -->
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"/>
<-- Create the app bundle -->
<target name="bundle-swingset" depends="package">
<bundleapp outputdirectory="."
name="Test"
displayname="Test"
identifier="com.oracle.javafx.swing.Test"
shortversion="1.0"
applicationCategory="public.app-category.developer-tools"
mainclassname="com/javafx/main/Main">
<runtime dir="${env.JAVA_HOME}">
<exclude name="Java IDL Server Tool" /> <!-- exclude from bundle -->
</runtime>
<classpath file="${user.home}/bin/javafx-samples-2.2.0/SwingInterop.jar"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
</bundleapp>
</target>
可選排除的完整列表可在JRE根被發現 - $JAVA_HOME/README.txt
。找到文本Optional Files and Directories
,你會看到它的標題。我正在查看計算機上的JRE7安裝,JRE6自述文件似乎沒有任何內容。
我知道這不是你正在尋找的例子,但我希望它能幫你弄明白。
我不知道Mac商店,但是你不能不捆綁JRE嗎? 大多數人已經擁有它。事實上,我認爲它默認使用Mac電腦 –
@Oxinabox蘋果在2010年左右停止在OS X中使用Java,因此只有那些出去下載它的人才擁有它。無論如何,Mac App Store要求所有應用程序都是自包含的,並且不需要默認安裝在OS X中的任何東西,因此JRE需要捆綁到應用程序中(最好不要添加138 MB)。 – Thunderforge
也許它會自動檢測JRE是否已經安裝,如果沒有,然後去應用程序安裝過程中下載它? – Vitruvius