Command Line mode is supported
Introduction
Jar2Exe Command Mode is a powerful and direct way to use Jar2Exe.
Every feature of Jar2Exe is supported at command line mode.
At the last step of Jar2Exe Wizard mode, you can get a equivalent command line string, so usually you need not to write the whole long command line by yourself.
Usage of J2EWIZ
You can type "j2ewiz /?" to get the tips of command line usage:
C:\>j2ewiz /? Usage: J2EWIZ [jarfile|classes directory] - jar filename or classes directory /? /h /help - display usage information /o <exefile> - exe filename to create /m <main.class.name> - startup class with main() method /type <console> - application type: console <windows> windows gui <service> service /minjre <1.2|1.3 etc> - minimum jre version required /maxjre <1.2|1.3 etc> - maximum jre version required /platform <windows|linux> - target platform /splash <picfile> - splash picture for windows gui type /closeonwindow - close splash when first window opens /splashtitle <title> - specify splash title string /filter <wildcard> - pattern to filter out files /service <name> - service name /serviceshow <show name> - service show name /servicedesc <service desc> - service description /servicedep <depended> - other service names depended /hide - hide files /encrypt - encrypt and hide files /eventlog - system event log support /systray - system tray icon support /embed <jarfile> - embed jar files depended /icon <iconfile> - icon file /amd64 - create 64-bit executive /checksum - enable exe self checksum /pv <x.x.x.x> - product version /fv <x.x.x.x> - file version /ve name=description - file version description /config <config line> - add a configuration line inside /message n=msg - define custom error message /authorize - authorize to run as product /xpmanifest - add xp manifest
[jarfile|classes directory]
A jar file path or a directory path. If this is a directory, the directory is regarded as a classes directory. All content in it will be add to exe file except those files match the "/filter" wildcard.
/? /h /help
To display the usage tip message.
/o <exefile>
The target exe file name to be created. If this value not specified, the default value is determined from the "jar file name" by changing the extension name.
/m <main.class.name>
The entrance of your program, the main class which has "public static void main(String [] argv)" defined.
/type <console|windows|service>
Application type to generate. Default value: console. See 3 Types of Applications for details of application type.
/minjre <1.2|1.3 etc>
/maxjre <1.2|1.3 etc>
Set the minimum and maximum java.version required respectively. Generated exe will check java.version before it runs. Default value: 1.2. After generated, this value can be overwritten by Configuration file, see minjie page.
/platform <windows|linux>
To create exe file for Windows or Linux.
/splash <picfile>
Set the splash image for Windows GUI type on Windows.
If the "/type" is not "windows" or "/platform" is not "windows", this parameter will be ignored.
/filter <wildcard>
If it is to generate exe from a classes directory, not a jar file, this filter is to remove unused files.
/service <name>
/serviceshow <show name>
/servicedesc <service desc>
/servicedep <depended>
These 4 parameters are to set service information. They are ignored if "/platform" is Linux.
/hide
/encrypt
To set the class protection option. See Class Protection page for more details about protection.
/eventlog
To enable Event Log function of generated exe. This value is ignored if "/platform" is Linux. See Event Log page for more details about Event Log.
/systray
To enable System Tray function of generated exe. This value is ignored if "/platform" is Linux. See System Tray page for more details about System Tray.
/embed <jarfile>
Add a depended jar library into exe file. This parameter "/embed" can be used more times, each time to add one jar file.
/icon <iconfile>
Add a icon file to exe file. This parameter "/icon" can be used more times. The first icon is to be the program icon. This value is ignored if "/platform" is Linux.
/amd64
To create a 64 bits of generated exe. If the Jar2Exe is 32 bits edition, this parameter is ignored.
/checksum
To enable generated exe self checksum. The default value is enabled, so you need to use "/checksum:false" to disable checksum explicitly.
/pv <x.x.x.x>
Set the product version. This value is ignored if "/platform" is Linux.
/fv <x.x.x.x>
Set the file version. This value is ignored if "/platform" is Linux.
/ve name=description
To set the version description. This parameter can be used more times, each time is to set a name=value pair. This value is ignored if "/platform" is Linux.
/config <config line>
To add a configuration line inside in the exe file. See Configuration page for details.
/message n=msg
To define a customized error message.
/authorize
Authorize the exe file to run as a product. The default value is true if Jar2Exe is activated. This parameter cannot be enabled if Jar2Exe is not activated.
/xpmanifest
Add XP manifest to resources of exe file, this will affect the style of Windows controls.
Comments
/fv does not work when using dots
when i build from cmd line /fv does not work properly when using dots 1.2.3.4
I have to use commas to get it to work
/pv works with dots
/fv 1,2,3,4 /pv 1.2.3.4 /ve ProductVersion=1.2.3.4 /ve FileVersion=1.2.3.4
windows 10 / OpenJDK 11.0.4
Keep files not hidden
Hi!
I'm having some problems when trying to generate an encrypted or hidden exe via CLI:
I need to keep META-INF folder not hidden, in GUI I can select that option, isn't it in command line?
remove artificial sleep
When I run j2ewiz from command line, it waits around 10 seconds before exit, which is very annoying when integrated with my installer script. Most probably the sleep is there to allow time for the users to run it, but some users might just run it integrated into other tools.
More exactly it displays the following text for ~10 seconds:
Executive file "C:\Myprojects\pacman\pacman.bin" created successfully.
Can you add a /nowait command line option which will eliminate this extra wait time at the end?
(j2ewiz might just exit with 0 on success or 1 with error, so it could be easily integrated in install scripts)
Thank you.
There is no artificial sleep
The wait is because Jar2Exe is processing the converting. You can try a small jar it will end immediately.
Yes j2ewiz will return 0 on success, non-0 on fail and different result means different fail reason.
remove artificial sleep
But it already displays "X.bin created successfully".
How it could display "create successfully" if still processing the converting?
I am not talking here about the overal time required to run j2ewiz.exe. Only the time while it displays "X.bin created successfully".
Converting war file to an exe.
Hi There,
I am trying to convert a .war file to .exe file.
I am able to do this when i do it manually.
But when i try to convert .war to .exe using command line i am facing error.
Below is the command i am usinng in my command prompt.
set JAR2EXE_TOOL="C:\Program Files\Jar2Exe Wizard\j2ewiz"
set VER=1.2.3.4
%JAR2EXE_TOOL% "abc.war" /m org.springframework.boot.loader.WarLauncher /pv %VER% /fv %VER% /o abc.exe
Can you please help me here.
Thanks in advance.
Use 'export' in config
Use 'export' in config file, since V2.0, for reference for everyone http://www.jar2exe.com/createdexe/config/export
silent exe generation using .j2e project file
Hi
is it possible to automate the generaion of the output exe using the input .j2e project file?
Would be really great to have such a feature!
Use '/make'
Thank you for your advice. Please use:
j2ewiz /make xxx.j2e
instead of the long command line.
Add new comment