Launch4j lỗi specify output file with exe extension năm 2024

Launch4j requires an xml configuration file for each output executable. You can create and edit it conveniently using the graphic user interface or your favorite editor. Alternatively it's possible to pass all of the configuration parameters through the Ant task. All files may be absolute paths or relative to the configuration file path.

Bold elements are required > **gui|console file.exe file true|false text http://java.com/download url text path normal|idle|high true|false true|false file header object file ... w32api lib ... var=text ...

****main class****  
****classpath****  
...  
****text****
text
  
****bundled JRE path****  
****x.x.x[_xx]****  
x.x.x[_xx]  
jreOnly|preferJre|preferJdk|jdkOnly  
  
MB
%  
MB
%  
text  
...  
****file****  
true|false  
seconds [60]  
true|false  
****x.x.x.x****  
****text****  
****text****  
****text****  
****x.x.x.x****  
****text****  
****text****  
text  
****filename****  
****filename.exe****  
****text****  
****text****  
****text****  
****text****  
Type of the header used to wrap the application. Header type Launcher Splash screen Wait for the application to close gui javaw yes wrapper waits only if stayAlive is set to true, otherwise it terminates immediately or after closing the splash screen. console java no always waits and returns application's exit code. Output executable file. Optional, by default specifies the jar to wrap. To launch a jar without wrapping it enter the runtime path of the jar relative to the executable and set to true. For example, if the executable launcher and the application jar named calc.exe and calc.jar are in the same directory then you would use calc.jar and true. Optional, defaults to false. Launch4j by default wraps jars in native executables, you can prevent this by setting to true. The exe acts then as a launcher and starts the application specified in or Optional, sets the title of the error message box that's displayed if Java cannot be found for instance. This usually should contain the name of your application. The console header prefixes error messages with this property (myapp: error...) Optional, constant command line arguments. Optional. Change current directory to an arbitrary path relative to the executable. If you omit this property or leave it blank it will have no effect. Setting it to . will change the current dir to the same directory as the executable. .. will change it to the parent directory, and so on.

.

../somedir

Optional, defaults to false. Set the process name as the executable filename and use Xp style manifests (if any). Creates a temporary file in launch4j-tmp directory inside the used JRE. These files are deleted by any launch4j wrapped application, which sets the process name and uses the same JRE. The removal takes place when the application starts, so at least one copy of this file will always be present. Optional, defaults to false in GUI header, always true in console header. When enabled the launcher waits for the Java application to finish and returns it's exit code. Application icon in ICO format. May contain multiple color depths/resolutions. Optional, custom headers only. Ordered list of header object files. Optional, custom headers only. Ordered list of libraries used by header. Optional, allow to run only a single instance of the application.

Unique mutex name that will identify the application. Optional, recognized by GUI header only. Title or title part of a window to bring up instead of running a new instance.

Required element that groups JRE settings.

, , The property is used to specify the absolute or relative path (to the executable) of a bundled JRE, it does not rely on the current directory or . Note that this path is not checked until the actual application execution. If you'd like the wrapper to search for a JRE (public or SDK private) use the property, you may also specify the to prevent it from using higher Java versions. Launch4j will always use the highest version available (in the min/max range of course). If a Sun's JRE is not available or does not satisfy the search criteria, the search will be repeated on IBM runtimes. You can also combine these properties to change the startup process...
Run if bundled JRE and javaw.exe are present, otherwise stop with error. + [+ ] Use bundled JRE first, if it cannot be located search for Java, if that fails display error message and open the Java download page. [+ ] Search for Java, if an appropriate version cannot be found display error message and open the Java download page.
Optional, defaults to preferJre; Allows you to specify a preference for a public JRE or a private JDK runtime. Valid values are:
jreOnly Always use a public JRE (equivalent to the old option dontUsePrivateJres=true) preferJre Prefer a public JRE, but use a JDK private runtime if it is newer than the public JRE (equivalent to the old option dontUsePrivateJres=false) preferJdk Prefer a JDK private runtime, but use a public JRE if it is newer than the JDK jdkOnly Always use a private JDK runtime (fails if there is no JDK installed)

HeapSize, HeapPercent If size and percent are specified, then the setting which yields more memory will be chosen at runtime. In other words, setting both values means: percent of free memory no less than size in MB.

Optional, initial heap size in MB. Optional, initial heap size in % of free memory. Optional, max heap size in MB. Optional, max heap size in % of free memory.

Optional, accepts everything you would normally pass to java/javaw launcher: assertion options, system properties and X options. Here you can map environment and special variables EXEDIR (exe's runtime directory), EXEFILE (exe's runtime full file path) to system properties. All variable references must be surrounded with percentage signs and quoted.

-Dlaunch4j.exedir="%EXEDIR%" > -Dlaunch4j.exefile="%EXEFILE%" > -Denv.path="%Path%" > -Dsettings="%HomeDrive%%HomePath%\settings.ini" >

Optional, groups the splash screen settings. Allowed only in GUI header.

Splash screen image in BMP format. Optional, defaults to true. Close the splash screen when an application window or Java error message box appears. If set to false, the splash screen will be closed on timeout. Optional, defaults to 60. Number of seconds after which the splash screen must be closed. Splash timeout may cause an error depending on . Optional, defaults to true. True signals an error on splash timeout, false closes the splash screen quietly.

Optional, version information to be displayed by the Windows Explorer.

Version number 'x.x.x.x' Free form file version, for example '1.20.RC1'. File description presented to the user. Legal copyright. Version number 'x.x.x.x' Free form file version, for example '1.20.RC1'. Text. Optional text. Internal name without extension, original filename or module name for example. Original name of the file without the path. Allows to determine whether a file has been renamed by a user.

Importing 1.x configuration

It's possible to import a 1.x configuration file using the GUI interface. Open the file, correct the paths and save it as a new xml configuration.

Ant task

You may set a launch4j directory property or change the task definition.

Define the task in your Ant build script.

classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar :${launch4j.dir}/lib/xstream.jar" /> Execute the task!

You can set or override the following configuration properties...

jar="absolute path or relative to basedir" jarPath="relative path" outfile fileVersion txtFileVersion productVersion txtProductVersion bindir="" tmpdir=""

launch4jc.exe config.xml

0

You can also define the entire configuration in the task, but it will not be possible to edit such a file in the GUI mode. All paths except for , and jarPath are calculated using the basedir project attribute.

launch4jc.exe config.xml

1

Additional JVM options at runtime

When you create a wrapper or launcher all configuration details are compiled into the executable and cannot be changed without recreating it or hacking with a resource editor. Launch4j 2.1.2 introduces a new feature that allows to pass additional JVM options at runtime from an .l4j.ini file. Now you can specify the options in the configuration file, ini file or in both, but you cannot override them. The ini file's name must correspond to the executable's (myapp.exe : myapp.l4j.ini). The arguments should be separated with spaces or new lines, environment variable expansion is supported, for example: