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.



JRE - Auto install

Will it be able to automatically install the JRE if the HOST machine where we install the generated installer doesn't have JAVA installed on it?

No, it cannot

You can copy a 'jre' folder along with the exe file, then the JRE does not have to be INSTALLed.


Problem with dimension


I have problmes with dimension of my program. I use a laptop when I have your program installed and another one when usually I use my programs. If I use Jars, all works well. But if I wrap my Jar on a laptop, and I use it on the other one, the program frames are sized well but the internal program works with the dimensions I have on the other laptop.

I explain, I saw the program maximed, but if I print the dimensions of the maximed frame, it replies me "java.awt.Dimension[width=1296,height=736]". But, exeptionally, the fonts are small (that is good!).

The problem is with your wrapper, because if I use the Jar, without the wrapper, it prints 1942 x 1102.

What can I do?

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

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

The JRE is required when

The JRE is required when generated exe file runs. Jar2Exe is to protect java program from being extracted. Please contact me if you want to tell me more.

Java runtime not valid

I converted jar file to exe, it's running on my PC well, but on another PC running windows 10 it gives error message "Java runtime environment not valid"

Java runtime not valid on Windows Store install

I'm getting Java runtime not valid after packaging my application for the Microsoft Store.  So if the application is packaged and installed using our installer, it works fine on Windows 10, but if the application is pulled down from the Microsoft Store ( I get the error.  The a JVM is not packaged within the exe.  The Windows 10 system has a legitimate JVM installed.

fail in loading library

my EXe converted from Java code is running in windows 8.1, but give missing java liberary in window 10, is your produced exe support windows 10 64bit

Create a Console window to check the error message

I'm not sure which kind of 'library', is it a 'jar file' or a 'dll file' ?

You can try to create a Console program instead and you will get an error message on the console window.

What does the "library not found error" describe ?

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?

Add new comment