Solution Advice: Desktop window

A desktop window program is to display a window from Java, usually without a Console window


If your java program will show a window as your program's user interface, this advice will show you typical solutions with Jar2Exe.


This type of desktop window program is usually started from a shortcut, not from command line, and usually the console window is not needed. So we should create a "Windows GUI application" from Jar2Exe. It is better to select a custom program icon, which will also be the icon of the shortcut. It is more friendly to show a splash window before main window opens, to tell user program is starting.

Features used

We advise you to use following features:

Feature Advice Introduction How to enable

GUI application


To let the console window invisible, it is required to select "Windows GUI application" type.

At Step 2, select Windows GUI

Minimum JRE


If you use a feature since certain version of JRE, you'd better set a min JRE version.

At Step 1, select a Min version



If you want to protect your program from being extracted and decompiled, you can select to encrypt it.

At Step 4, check the encrypt option

Splash window


To display a splash window is more friendly. This can tell user the program is starting.

At Step 3, select a picture

Program icon


A desktop window program is usually started from a shortcut, so the program icon will also be the icon of the shortcut.

At Step 6 > Version & messages

Force CWD


If your program need to run in a certain "working directory", you can enable "Force CWD" to ignore the start position.

At Step 6 > Config Internal > Custom tab, use a 'forcecwd' item

Stdout redirect


Because the console window is not visible, if you need to get the content of System.out, you can redirect it  to a disk file.

At Step 6 > Config Internal > Custom tab, use a 'stdout' item

System tray

Optional If your program will run for a long time and you want it keep running after window is closed, you can minimize it to a System tray. At Step 4, enable System tray, then use Integrate API to create


Steps of this advice:

  1. The demo program is from
  2. Compile and pack the classes into a jar file: RegExLab.jar
  3. Start Jar2Exe, at step 1, click Browse Jar and select 'RegExLab.jar'
  4. At step 1, click the Min box and edit it to 1.4.2.
  5. At step 2, select Windows GUI application.
  6. At step 3, select the main class com.wpollock.regexp.RegExLab
  7. At step 3, click Browse and select an image file as the splash window
  8. At step 4, check the Encrypt and hide class files option.
  9. At step 4, check the Support system tray option if you need.
  10. At step 6, click "Version & Message", then
    1. At "Product Info" tab, click Add to add a program icon.
    2. Click OK to close this popup dialog.
  11. At step 6, click "Config Internal", then
    1. At Custom tab, append "forcecwd ." to set the "working directory".
    2. At Custom tab, append "stdout out.log" to redirect System.out to a disk file.
    3. Click OK to close this popup dialog.
  12. Click Next to create the RegExLab.exe file.



Library not found

I created an application from jar file to exe with Jar2exe and created setup with Inno Setup.   After installation in other laptop, it has library not found error.  Is there any way to find out what library is missing?   Is there any way to setup URL for user to download when library missing?

not running on other computers


The GUI exe I created doesn't run on many other computers.  It just doesn't open, or if it does open (on one), it is extreamly leggy and doesn't close even when clicking the X for 30 seconds.

It does run on my two computers that already have JRE installed.


Mohammad Afdal

Java Has Stopped Working

My jar2exe output file runs in many PC's but sometime it shows Java has stopped working in Java 7-8 Environment.So what would be the -Jmxx and -Jmxs optimum value for normal PC's

Add new comment