Skip to content

Commit ac012af

Browse files
author
gk_brown
committed
Add appbunder task documentation.
git-svn-id: https://svn.java.net/svn/appbundler~svn@10 07572b26-92e5-4d45-f66a-c18421440a21
1 parent aa9ff0d commit ac012af

File tree

2 files changed

+196
-3
lines changed

2 files changed

+196
-3
lines changed

appbundler/doc/appbundler.html

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
<!--
2+
Copyright 2012, Oracle and/or its affiliates. All rights reserved.
3+
4+
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5+
6+
This code is free software; you can redistribute it and/or modify it
7+
under the terms of the GNU General Public License version 2 only, as
8+
published by the Free Software Foundation. Oracle designates this
9+
particular file as subject to the "Classpath" exception as provided
10+
by Oracle in the LICENSE file that accompanied this code.
11+
12+
This code is distributed in the hope that it will be useful, but WITHOUT
13+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15+
version 2 for more details (a copy is included in the LICENSE file that
16+
accompanied this code).
17+
18+
You should have received a copy of the GNU General Public License version
19+
2 along with this work; if not, write to the Free Software Foundation,
20+
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21+
22+
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23+
or visit www.oracle.com if you need additional information or have any
24+
questions.
25+
-->
26+
27+
<html lang="en-us">
28+
29+
<head>
30+
<meta http-equiv="Content-Language" content="en-us">
31+
<link rel="stylesheet" type="text/css" href="http://ant.apache.org/manual/stylesheets/style.css">
32+
<title>AppBundler Task</title>
33+
</head>
34+
35+
<body>
36+
<h2><a name="appbundler">AppBundler</a></h2>
37+
<h3>Description</h3>
38+
<p>Generates a native launcher for a Java application.</p>
39+
40+
<h3>Parameters</h3>
41+
<table border="1" cellpadding="2" cellspacing="0">
42+
<tr>
43+
<td valign="top"><b>Attribute</b></td>
44+
<td valign="top"><b>Description</b></td>
45+
<td align="center" valign="top"><b>Required</b></td>
46+
</tr>
47+
<tr>
48+
<td valign="top">outputdirectory</td>
49+
<td valign="top">The output folder for the generated bundle.</td>
50+
<td align="center" valign="top">Yes</td>
51+
</tr>
52+
<tr>
53+
<td valign="top">name</td>
54+
<td valign="top">The name of the generated bundle.
55+
Corresponds to the <code>CFBundleName</code> key in the <tt>Info.plist</tt> file.</td>
56+
<td align="center" valign="top">Yes</td>
57+
</tr>
58+
<tr>
59+
<td valign="top">displayname</td>
60+
<td valign="top">The display name of the generated bundle.
61+
Corresponds to the <code>CFBundleDisplayName</code> key in the <tt>Info.plist</tt> file.</td>
62+
<td align="center" valign="top">Yes</td>
63+
</tr>
64+
<tr>
65+
<td valign="top">identifier</td>
66+
<td valign="top">An identifier string that specifies the application type of the bundle.
67+
Corresponds to the <code>CFBundleIdentifier</code> key in the <tt>Info.plist</tt> file.</td>
68+
<td align="center" valign="top">Yes</td>
69+
</tr>
70+
<tr>
71+
<td valign="top">icon</td>
72+
<td valign="top">The icon file for the bundle.
73+
Corresponds to the <code>CFBundleIconFile</code> key in the <tt>Info.plist</tt> file.</td>
74+
<td align="center" valign="top">No</td>
75+
</tr>
76+
<tr>
77+
<td valign="top">shortversion</td>
78+
<td valign="top">The release version number string for the bundle.
79+
Corresponds to the <code>CFBundleShortVersionString</code> key in the <tt>Info.plist</tt>
80+
file.</td>
81+
<td align="center" valign="top">No</td>
82+
</tr>
83+
<tr>
84+
<td valign="top">signature</td>
85+
<td valign="top">The four-letter code identifying the bundle creator.
86+
Corresponds to the <code>CFBundleSignature</code> key in the <tt>Info.plist</tt> file.</td>
87+
<td align="center" valign="top">No</td>
88+
</tr>
89+
<tr>
90+
<td valign="top">copyright</td>
91+
<td valign="top">The copyright notice for the bundle.
92+
Corresponds to the <code>NSHumanReadableCopyright</code> key in the <tt>Info.plist</tt>
93+
file.</td>
94+
<td align="center" valign="top">No</td>
95+
</tr>
96+
<tr>
97+
<td valign="top">runtime</td>
98+
<td valign="top">The Java runtime to embed in the bundle.
99+
Corresponds to the <code>JVMRuntime</code> key in the <tt>Info.plist</tt> file.
100+
If specified, the contents of this directory will be copied to the <tt>Contents/PlugIns/</tt>
101+
folder of the generated bundle.</td>
102+
<td align="center" valign="top">No; if unspecified, the target system must have a shared JRE
103+
installed in <tt>/Library/Internet Plug-Ins/JavaAppletPlugin.plugin</tt>.</td>
104+
</tr>
105+
<tr>
106+
<td valign="top">mainclassname</td>
107+
<td valign="top">The name of the bundled application's main class.
108+
Corresponds to the <code>JVMMainClassName</code> key in the <tt>Info.plist</tt>
109+
file.</td>
110+
<td align="center" valign="top">Yes</td>
111+
</tr>
112+
<tr>
113+
<td valign="top">classpath</td>
114+
<td valign="top">The classpath of the bundled application. If an entry refers to a directory,
115+
it will be recursively copied to the <tt>Contents/Java/Classes/</tt> folder of the generated
116+
bundle. Otherwise, the entryt will be copied to the <tt>Contents/Java/</tt> folder of the
117+
generated bundle.</td>
118+
<td align="center" valign="top">Yes, unless nested <code>&lt;classpath&gt;</code> elements are
119+
present.</td>
120+
</tr>
121+
<tr>
122+
<td valign="top">nativelibraries</td>
123+
<td valign="top">Any native libraries required by the bundled application. Entries will be
124+
copied to the <tt>Contents/Java/</tt> folder of the generated bundle.</td>
125+
<td align="center" valign="top">Yes, unless nested <code>&lt;nativelibraries&gt;</code> elements are
126+
present.</td>
127+
</tr>
128+
</table>
129+
130+
<h3>Parameters specified as nested elements</h3>
131+
<h4>classpath</h4>
132+
<p>The <code>classpath</code> and <code>nativelibraries</code> attributes are
133+
<a href="http://ant.apache.org/manual/using.html#path">path-like structures</a> that can also be
134+
set via nested <code>&lt;classpath&gt;</code> and <code>&lt;nativelibraries&gt;</code> elements,
135+
respectively.</p>
136+
137+
<h4>option</h4>
138+
<p>Specifies a command-line option to be passed to the JVM at startup.</p>
139+
<table border="1" cellpadding="2" cellspacing="0">
140+
<tr>
141+
<td valign="top"><b>Attribute</b></td>
142+
<td valign="top"><b>Description</b></td>
143+
<td align="center" valign="top"><b>Required</b></td>
144+
</tr>
145+
<tr>
146+
<td valign="top">value</td>
147+
<td valign="top">The option value.</td>
148+
<td align="center" valign="top">Yes</td>
149+
</tr>
150+
</table>
151+
152+
<h4>argument</h4>
153+
<p>Specifies a command-line argument to be passed to the application at startup.</p>
154+
<table border="1" cellpadding="2" cellspacing="0">
155+
<tr>
156+
<td valign="top"><b>Attribute</b></td>
157+
<td valign="top"><b>Description</b></td>
158+
<td align="center" valign="top"><b>Required</b></td>
159+
</tr>
160+
<tr>
161+
<td valign="top">value</td>
162+
<td valign="top">The argument value.</td>
163+
<td align="center" valign="top">Yes</td>
164+
</tr>
165+
</table>
166+
167+
<h3>Examples</h3>
168+
<p>Generate a launcher for the "Swing Set" demo, bundling the JRE defined by the
169+
<tt>JAVA_HOME</tt> environment variable with the resulting executable:</p>
170+
<pre>
171+
&lt;-- Import environment variables --&gt;
172+
&lt;property environment="env"/&gt;
173+
174+
&lt;-- Define the appbundler task --&gt;
175+
&lt;taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"/&gt;
176+
177+
&lt;-- Create the app bundle --&gt;
178+
&lt;target name="bundle-swingset" depends="package"&gt;
179+
&lt;bundleapp outputdirectory="."
180+
name="SwingSet2"
181+
displayname="SwingSet 2"
182+
identifier="com.oracle.javax.swing.SwingSet2"
183+
shortversion="1.0"
184+
runtime="${env.JAVA_HOME}/../.."
185+
mainclassname="SwingSet2"&gt;
186+
&lt;classpath file="/Library/Java/Demos/JFC/SwingSet2/SwingSet2.jar"/&gt;
187+
&lt;option value="-Dapple.laf.useScreenMenuBar=true"/&gt;
188+
&lt;/bundleapp&gt;
189+
&lt;/target&gt;
190+
</pre>
191+
192+
</body>
193+
</html>

appbundler/src/com/oracle/appbundler/AppBundlerTask.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ public void addConfiguredArgument(Argument argument) throws BuildException {
175175
public void execute() throws BuildException {
176176
// Validate required properties
177177
if (outputDirectory == null) {
178-
throw new IllegalStateException("Destination directory is required.");
178+
throw new IllegalStateException("Output directory is required.");
179179
}
180180

181181
if (!outputDirectory.exists()) {
182-
throw new IllegalStateException("Destination directory does not exist.");
182+
throw new IllegalStateException("Output directory does not exist.");
183183
}
184184

185185
if (!outputDirectory.isDirectory()) {
186-
throw new IllegalStateException("Invalid destination directory.");
186+
throw new IllegalStateException("Invalid output directory.");
187187
}
188188

189189
if (name == null) {

0 commit comments

Comments
 (0)