source: release-kits/shared/launch4j/web/docs.html@ 15024

Last change on this file since 15024 was 15024, checked in by oranfry, 16 years ago

putting launch4j in the shared area

File size: 18.9 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3 <head>
4 <title>Launch4j - Cross-platform Java executable wrapper</title>
5 <meta name="description" content="Cross-platform Java executable wrapper for creating lightweight Windows native EXEs. Provides better user experience.">
6 <meta name="keywords" content="java executable wrapper, java application wrapper, exe wrapper, jar wrapper, wrap, wraps, wrapping, free software, launch, launcher, linux, mac, windows, open source, ant, solaris, native splash screen, deploy, build tool">
7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8 <meta name="author" content="Grzegorz Kowal" >
9 <link rel="stylesheet" type="text/css" href="style.css">
10 </head>
11 <body>
12 <div id="container">
13 <div id="top">
14 <img style="width: 249px; height: 58px;" src="launch4j.gif" alt="launch4j"> <span class="version">2.1.5</span>
15 </div>
16 <div id="leftnav">
17 <ul>
18 <li><a href="index.html">Home</a></li>
19 <li><a href="docs.html">Docs</a></li>
20 <li><a href="changelog.html">Changelog</a></li>
21 <li><a href="http://sourceforge.net/project/screenshots.php?group_id=95944">Screenshots</a></li>
22 <li><a href="http://sourceforge.net/project/showfiles.php?group_id=95944&amp;package_id=152236">Download</a></li>
23 <li><a href="http://sourceforge.net/forum/?group_id=95944">Support</a></li>
24 <li><a href="http://sourceforge.net/projects/launch4j">Project summary</a></li>
25 <li><a href="http://sourceforge.net/tracker/?atid=613100&amp;group_id=95944">Bug tracker</a></li>
26 <li><a href="links.html">Links</a></li>
27 </ul>
28 <ul style="margin-top: 20px; font-size: 75%">
29 <li><a href="index.html">English</a></li>
30 <li><a href="index_es.html">Español</a></li>
31 </ul>
32 </div>
33 <div id="content">
34<a href="#Running_launch4j">Running launch4j</a><br>
35<a href="#Configuration_file">Configuration file</a><br>
36<a href="#Importing_1.x_configuration">Importing 1.x configuration</a><br>
37<a href="#Ant_task">Ant Task</a><br>
38<a href="#Additional_jvm_options">Additional JVM options at runtime</a><br>
39<a href="#Debug_launching_mode">Debug launching mode</a><br>
40<a href="#Settings">Settings</a><br>
41
42<h2 id="Running_launch4j">Running launch4j</h2>
43Run <em>launch4j.exe</em> or <em>launch4j</em> script without command
44line arguments to enter the GUI mode.
45
46<pre>launch4j.exe</pre>
47
48To wrap a jar in console mode use <em>launch4jc.exe</em>&nbsp;<em></em>and
49specify the configuration file.
50
51<pre>launch4jc.exe config.xml</pre>
52
53On Linux use the <em>launch4j</em> script.
54
55<pre>launch4j ./demo/l4j/config.xml</pre>
56
57<h2 id="Configuration_file">Configuration file</h2>
58Launch4j requires an xml configuration file for each output executable.
59You can create and edit it conveniently using the graphic user
60interface or your favorite editor. Alternatively it's possible to pass
61all of the configuration parameters through the Ant task. All files
62except for <em>&lt;jre&gt;&lt;path&gt;</em>
63may be absolute paths or relative to the configuration file path.
64
65<pre>&lt;!-- <strong>Bold</strong> elements are required --&gt;<br><strong>&lt;launch4jConfig&gt;<br></strong> &lt;!-- Header types: 0-GUI, 1-console --&gt;<strong><br></strong> <strong>&lt;headerType&gt;</strong><span class="codeword">0|1</span><strong>&lt;/headerType&gt;</strong><br><strong></strong> <strong>&lt;outfile&gt;</strong><span class="codeword">file.exe</span><strong><span class="codeword"></span>&lt;/outfile&gt;<br></strong> <strong>&lt;jar&gt;</strong><span class="codeword">file</span><span class="codeword"></span><strong>&lt;/jar&gt;<br></strong> &lt;dontWrapJar&gt;<span class="codeword">true|<u>false</u></span>&lt;/dontWrapJar&gt;<br> &lt;errTitle&gt;<span class="codeword">text</span>&lt;/errTitle&gt;<br> &lt;jarArgs&gt;<span class="codeword">text</span>&lt;/jarArgs&gt;<br> &lt;chdir&gt;<span class="codeword">path</span>&lt;/chdir&gt;<br> &lt;customProcName&gt;<span class="codeword">true|<u>false</u></span>&lt;/customProcName&gt;<br> &lt;stayAlive&gt;<span class="codeword">true|false</span>&lt;/stayAlive&gt;<br> &lt;icon&gt;<span class="codeword">file</span>&lt;/icon&gt;<br> &lt;headerObjects&gt;<br> <strong>&lt;file&gt;</strong><span class="codeword">object file</span><strong>&lt;/file&gt;</strong><br> <strong>&lt;file&gt;</strong><span class="codeword">object file</span><strong>&lt;/file&gt;</strong><br> <strong>...</strong><br> &lt;/headerObjects&gt;<br> &lt;libs&gt;<br> <strong>&lt;file&gt;</strong><span class="codeword">w32api lib</span><strong>&lt;/file&gt;<br></strong><strong> &lt;file&gt;</strong><span class="codeword">w32api lib</span><strong>&lt;/file&gt;<br> ...<br></strong> &lt;/libs&gt;<br> <strong>&lt;jre&gt;<br></strong> &lt;!-- Specify one of the following or both --&gt;<br> <strong>&lt;path&gt;</strong><span class="codeword">path</span><strong>&lt;/path&gt;<br> </strong><strong>&lt;minVersion&gt;</strong><span class="codeword">x.x.x[_xx]</span><strong>&lt;/minVersion&gt;<br></strong> &lt;maxVersion&gt;<span class="codeword">x.x.x[_xx]</span>&lt;/maxVersion&gt;<br> &lt;!-- Heap sizes in MB, 0-use default --&gt;<br> &lt;initialHeapSize&gt;<span class="codeword">MB</span>&lt;/initialHeapSize&gt;<br> &lt;maxHeapSize&gt;<span class="codeword">MB</span>&lt;/maxHeapSize&gt;<br> &lt;args&gt;<span class="codeword">text</span>&lt;/args&gt;<br> <strong>&lt;/jre&gt;</strong><br> &lt;splash&gt;<br> <strong>&lt;file&gt;</strong><span class="codeword">file</span><strong>&lt;/file&gt;</strong><br> &lt;waitForWindow&gt;<span class="codeword"><u>true</u>|false</span>&lt;/waitForWindow&gt;<br> &lt;timeout&gt;<span class="codeword">seconds [60]</span>&lt;/timeout&gt;<br> &lt;timeoutErr&gt;<span class="codeword"><u>true</u>|false</span>&lt;/timeoutErr&gt;<br> &lt;/splash&gt;<br> &lt;versionInfo&gt;<br> <strong>&lt;fileVersion&gt;</strong><span class="codeword">x.x.x.x</span><strong>&lt;/fileVersion&gt;</strong><br> <strong>&lt;txtFileVersion&gt;</strong><span class="codeword">text</span><strong>&lt;/txtFileVersion&gt;</strong><br> <strong>&lt;fileDescription&gt;</strong><span class="codeword">text</span><strong>&lt;/fileDescription&gt;</strong><br> <strong>&lt;copyright&gt;</strong><span class="codeword">text</span><strong>&lt;/copyright&gt;</strong><br> <strong>&lt;productVersion&gt;</strong><span class="codeword">x.x.x.x</span><strong>&lt;/productVersion&gt;</strong><br> <strong>&lt;txtProductVersion&gt;</strong><span class="codeword">text</span><strong>&lt;/txtProductVersion&gt;</strong><br> <strong>&lt;productName&gt;</strong><span class="codeword">text</span><strong>&lt;/productName&gt;</strong><br> &lt;companyName&gt;<span class="codeword">text</span>&lt;/companyName&gt;<br> <strong>&lt;internalName&gt;</strong><span class="codeword">filename</span><strong>&lt;/internalName&gt;</strong><br> <strong>&lt;originalFilename&gt;</strong><span class="codeword">filename.exe</span><strong>&lt;/originalFilename&gt;</strong><br> &lt;/versionInfo&gt;<br><strong>&lt;/launch4jConfig&gt;</strong><br></pre>
66
67<dl>
68 <dt>&lt;headerType&gt;</dt>
69 <dd>
70 Type of the header used to wrap the application.
71 <table>
72 <thead>
73 <tr>
74 <th>Header type</th>
75 <th>App type</th>
76 <th>Launcher</th>
77 <th>Splash screen</th>
78 <th style="white-space: nowrap">Wait for the application to close</th>
79 </tr>
80 </thead>
81 <tbody>
82 <tr>
83 <td>0</td>
84 <td>GUI</td>
85 <td>javaw</td>
86 <td>yes</td>
87 <td class="description">wrapper waits only if <em>stayAlive</em> is set to true,
88 otherwise it terminates immediately or after closing
89 the splash screen.
90 </td>
91 </tr>
92 <tr>
93 <td>1</td>
94 <td>console</td>
95 <td>java</td>
96 <td>no</td>
97 <td class="description">always waits and returns application's exit code.</td>
98 </tr>
99 </tbody>
100 </table>
101 </dd>
102</dl>
103<dl>
104 <dt>&lt;outfile&gt;</dt>
105 <dd>Output executable file.</dd>
106</dl>
107<dl>
108 <dt>&lt;jar&gt;</dt>
109 <dd>
110 Depends on <em>&lt;dontWrapJar&gt;</em>, if false (the default) then
111 this element is the executable jar to wrap.
112 When <em>&lt;dontWrapJar&gt;</em> is set to true
113 it's the runtime path of the jar relative to the executable. For
114 example, if the executable launcher and the application jar named
115 <i>calc.exe</i> and <i>calc.jar</i> are in the same directory
116 then you would use <i>&lt;jar&gt;calc.jar&lt;/jar&gt;</i>.
117 </dd>
118</dl>
119<dl>
120 <dt>&lt;dontWrapJar&gt;</dt>
121 <dd>
122 Optional, defaults to false. Launch4j by default wraps jars in native
123 executables, you can prevent this by setting <em>&lt;dontWrapJar&gt;</em> to true.
124 The exe acts then as a launcher and starts the application specified in
125 <em>&lt;jar&gt;</em>
126 </dd>
127</dl>
128<dl>
129 <dt>&lt;errTitle&gt;</dt>
130 <dd>
131 Optional, sets the title of the error message box that's displayed if Java cannot
132 be found for instance. This usually should contain the name of your
133 application. The console header prefixes error messages with this
134 property (myapp: error...)
135 </dd>
136</dl>
137<dl>
138 <dt>&lt;jarArgs&gt;</dt>
139 <dd>Optional, constant command line arguments.</dd>
140</dl>
141<dl>
142 <dt>&lt;chdir&gt;</dt>
143 <dd>Optional. Change current directory to an arbitrary path relative to the executable.
144 If you omit this property or leave it blank it will have no effect.
145 Setting it to <em>.</em> will change the current dir to the same directory
146 as the executable. <em>..</em> will change it to the parent directory, and so on.
147 </dd>
148 <dd>
149 <pre>&lt;chdir&gt;.&lt;/chdir&gt;</pre>
150 </dd>
151 <dd>
152 <pre>&lt;chdir&gt;../somedir&lt;/chdir&gt;</pre>
153 </dd>
154</dl>
155<dl>
156 <dt>&lt;customProcName&gt;</dt>
157 <dd>Optional, defaults to false.
158 Set the process name as the executable filename. Creates a temporary
159 file in launch4j-tmp directory inside the used JRE. These files are
160 deleted by any launch4j wrapped application, which sets
161 the process name and uses the same JRE. The removal takes place
162 when the application <strong>starts</strong>,
163 so at least one copy of this file will always be present.
164 </dd>
165</dl>
166<dl>
167 <dt>&lt;stayAlive&gt;</dt>
168 <dd>Optional, defaults to false in GUI header, always true in console header.
169 When enabled the launcher waits for the Java application
170 to finish and returns it's exit code.
171 </dd>
172</dl>
173<dl>
174 <dt>&lt;icon&gt;</dt>
175 <dd>Application icon in ICO format. May contain multiple color depths/resolutions.</dd>
176</dl>
177<dl>
178 <dt>&lt;headerObjects&gt;</dt>
179 <dd>Optional, custom headers only. Ordered list of header object files.</dd>
180</dl>
181<dl>
182 <dt>&lt;libs&gt;</dt>
183 <dd>Optional, custom headers only. Ordered list of libraries used by header.</dd>
184</dl>
185<dl>
186 <dt>&lt;jre&gt;</dt>
187 <dd>Required element that groups JRE settings.</dd>
188</dl>
189<blockquote>
190 <dl>
191 <dt>&lt;path&gt;, &lt;minVersion&gt;, &lt;maxVersion&gt;</dt>
192 <dd>The <em>&lt;path&gt;</em> property is used
193 to specify the absolute or relative path (to the executable) of an embedded JRE, it
194 does not rely on the current directory or <em>&lt;chdir&gt;</em>.
195 Note that this path is not checked until the actual application execution.
196 If you'd like the wrapper to search for a JRE (public or SDK private)
197 use the <em>&lt;minVersion&gt;</em> property, you may also specify
198 the <em>&lt;maxVersion&gt;</em> to prevent it from using higher Java versions.
199 Launch4j will always use the highest version available (in the min/max range of course).
200 You can also combine these properties to change the startup process...
201 </dd>
202 </dl>
203 <blockquote>
204 <dl>
205 <dt>&lt;path&gt;</dt>
206 <dd>Run if bundled JRE and javaw.exe are present, otherwise stop with error.</dd>
207 <dt>&lt;path&gt; + &lt;minVersion&gt;&nbsp; [+ &lt;maxVersion&gt;]</dt>
208 <dd>Use bundled JRE first, if it cannot be located search for Java,
209 if that fails display error message and open the Java download page.
210 </dd>
211 <dt>&lt;minVersion&gt;&nbsp; [+ &lt;maxVersion&gt;]</dt>
212 <dd>Search for Java, if an appropriate version cannot be found display
213 error message and open the Java download page.
214 </dd>
215 </dl>
216 </blockquote>
217</blockquote>
218<blockquote>
219 <dl>
220 <dt>&lt;initialHeapSize&gt;</dt>
221 <dd>Optional, initial heap size in MB, 0 - use default.</dd>
222 </dl>
223 <dl>
224 <dt>&lt;maxHeapSize&gt;</dt>
225 <dd>Optional, max heap size in MB, 0 - use default.</dd>
226 </dl>
227 <dl>
228 <dt>&lt;args&gt;</dt>
229 <dd>Optional, accepts everything you would normally pass to
230 java/javaw launcher: assertion options, system properties and X options.
231 Here you can map environment and special variables <em>EXEDIR</em>
232 (exe's runtime directory), <em>EXEFILE</em> (exe's runtime full file path)
233 to system properties. All variable references must be surrounded with
234 percentage signs and quoted.
235 <pre>-Dlaunch4j.exedir="%EXEDIR%"<br>-Dlaunch4j.exefile="%EXEFILE%"<br>-Denv.path="%Path%"<br>-Dsettings="%HomeDrive%%HomePath%\\app-settings.ini"</pre>
236 </dd>
237 </dl>
238</blockquote>
239
240<dl>
241 <dt>&lt;splash&gt;</dt>
242 <dd>Optional, groups the splash screen settings. Allowed only in GUI header.</dd>
243</dl>
244<blockquote>
245 <dl>
246 <dt>&lt;file&gt;</dt>
247 <dd>Splash screen image in BMP format.</dd>
248 </dl>
249 <dl>
250 <dt>&lt;waitForWindow&gt;</dt>
251 <dd>Optional, defaults to true. Close the splash screen when an application
252 window or Java error message box appears. If set to false,
253 the splash screen will be closed on timeout.
254 </dd>
255 </dl>
256 <dl>
257 <dt>&lt;timeout&gt;</dt>
258 <dd>Optional, defaults to 60. Number of seconds after which the splash screen
259 must be closed. Splash timeout may cause an error depending on
260 <em>&lt;timeoutErr&gt;</em>.
261 </dd>
262 </dl>
263 <dl>
264 <dt>&lt;timeoutErr&gt;</dt>
265 <dd>Optional, defaults to true. True signals an error on splash timeout,
266 false closes the splash screen quietly.
267 </dd>
268 </dl>
269</blockquote>
270
271<dl>
272 <dt>&lt;versionInfo&gt;</dt>
273 <dd>Optional, version information to be displayed by the Windows Explorer.</dd>
274</dl>
275<blockquote>
276 <dl>
277 <dt>&lt;fileVersion&gt;</dt>
278 <dd>Version number 'x.x.x.x'</dd>
279 </dl>
280 <dl>
281 <dt>&lt;txtFileVersion&gt;</dt>
282 <dd>Free form file version, for example '1.20.RC1'.</dd>
283 </dl>
284 <dl>
285 <dt>&lt;fileDescription&gt;</dt>
286 <dd>File description presented to the user.</dd>
287 </dl>
288 <dl>
289 <dt>&lt;copyright&gt;</dt>
290 <dd>Legal copyright.</dd>
291 </dl>
292 <dl>
293 <dt>&lt;productVersion&gt;</dt>
294 <dd>Version number 'x.x.x.x'</dd>
295 </dl>
296 <dl>
297 <dt>&lt;txtProductVersion&gt;</dt>
298 <dd>Free form file version, for example '1.20.RC1'.</dd>
299 </dl>
300 <dl>
301 <dt>&lt;productName&gt;</dt>
302 <dd>Text.</dd>
303 </dl>
304 <dl>
305 <dt>&lt;companyName&gt;</dt>
306 <dd>Optional text.</dd>
307 </dl>
308 <dl>
309 <dt>&lt;internalName&gt;</dt>
310 <dd>Internal name without extension, original filename or module name for example.</dd>
311 </dl>
312 <dl>
313 <dt>&lt;originalFilename&gt;</dt>
314 <dd>Original name of the file without the path. Allows to determine
315 whether a file has been renamed by a user.
316 </dd>
317 </dl>
318</blockquote>
319
320<h2 id="Importing_1.x_configuration">Importing 1.x configuration</h2>
321It's possible to import a 1.x configuration file using the GUI
322interface. Open the file, correct the paths and save it as a new xml
323configuration.
324
325<h2 id="Ant_task">Ant task</h2>
326You may set a launch4j directory property or change the task definition.
327
328<pre>&lt;property name="launch4j.dir" location="/opt/launch4j" /&gt;</pre>
329
330Define the task in your Ant build script.
331
332<pre>&lt;taskdef name="launch4j"<br> classname="net.sf.launch4j.ant.Launch4jTask"<br> classpath="${launch4j.dir}/launch4j.jar<br> :${launch4j.dir}/lib/xstream.jar" /&gt;</pre>
333
334Execute the task!
335
336<pre>&lt;launch4j configFile="./l4j/demo.xml" /&gt;</pre>
337
338You can set or override the following configuration properties...
339<p class="attrib">
340 jar="absolute path or relative to <em>basedir</em>"<br>
341 jarPath="relative path"<br>
342 outfile<br>
343 fileVersion<br>
344 txtFileVersion<br>
345 productVersion<br>
346 txtProductVersion
347</pn>
348
349<pre>&lt;launch4j configFile="./l4j/demo.xml"<br> outfile="mydemo.exe"<br> &nbsp;fileVersion="1.0.0.0" txtFileVersion="1.0 RC2" /&gt;</pre>
350
351You can also define the entire configuration in the task, but it will
352not be possible to edit such a file in the GUI mode. All paths except
353for <em>&lt;chdir&gt;</em>, <em>&lt;jre&gt;&lt;path&gt;</em> and <em>jarPath</em>
354are calculated using the <em>basedir</em> project attribute.
355
356<pre>&lt;launch4j&gt;<br> &lt;config headerType="0" outfile="demo.exe"<br> dontWrapJar="true" jarPath="demo.jar" &gt;<br> &lt;jre minVersion="1.4.0" /&gt;<br> &lt;/config&gt;<br>&lt;/launch4j&gt;</pre>
357
358<h2 id="Additional_jvm_options">Additional JVM options at runtime</h2>
359When you create a wrapper or launcher all configuration details are compiled into the
360executable and cannot be changed without recreating it or hacking with a resource editor.
361Launch4j 2.1.2 introduces a new feature that allows to pass additional JVM options
362at runtime from an .ini file. Now you can specify the options in the configuration file,
363ini file or in both, but you cannot override them. The ini file's name must correspond
364to the executable's <em>(myapp.exe : myapp.ini)</em>.
365The arguments should be separated with spaces or new lines, environment variable
366expansion is supported, for example:
367<pre>-Dswing.aatext=true<br>-Dsomevar="%SOMEVAR%"<br>-Xms16m</pre>
368
369<h2 id="Debug_launching_mode">Debug launching mode</h2>
370To make sure the output executable is configured correctly you can use the
371debug launching mode which displays various information before starting the Java application.
372To enable it set the environment variable <em>launch4j=debug</em> and run the wrapped
373program. When using the GUI header redirect standard output to a file to see the results.
374<pre>set launch4j=debug<br>app.exe &gt;launch4j.log</pre>
375
376<h2 id="Settings">Settings</h2>
377<h3>Alternate bin directory: launch4j.bindir</h3>
378It's possible to override the default bin directory location which contains windres and ld
379tools using the <em>launch4j.bindir</em> system property. The property can have two forms:
380 a path relative to Launch4j's directory (<em>altbin</em> for example) or an absolute path.
381
382<h3>Working directory: launch4j.tmpdir</h3>
383Change the working directory if the default path contains spaces which windres cannot handle.
384 </div>
385 <div class="footer">
386 Copyright &copy; 2005-2006 Grzegorz Kowal
387 <p style="margin-top: 2em">
388 <a href="http://sourceforge.net"><img style="width: 125px; height: 37px; border: none" src="http://sourceforge.net/sflogo.php?group_id=95944&amp;type=4" alt="sf.net"></a>
389 <a href="http://www.nosoftwarepatents.com"><img style="width: 90px; height: 40px; border: none; margin-left: 5%" src="http://www.nosoftwarepatents.com/banners/90x40_3.jpg" alt=""></a>
390 <a href="http://validator.w3.org/check?uri=referer"><img style="width: 88px; height: 31px; border: none; margin-left: 5%" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
391 </p>
392 </div>
393 </div>
394 </body>
395</html>
Note: See TracBrowser for help on using the repository browser.