Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:08:46+00:00 2026-05-29T23:08:46+00:00

Requirements I want to publish a Java GUI application on Windows 7. This application

  • 0

Requirements

I want to publish a Java GUI application on Windows 7. This application is using the Swing Toolkit and doesn’t need any native code. The application is installed using an NSIS installer. I want to integrate this application into Windows 7 as good as possible. This means:

  • When the application is running it must be possible to pin the application to the taskbar.
  • It must be possible to associate data files with the application so Windows opens these files with my application.
  • Must automatically work with the 32 bit Java Runtime and with the 64 bit Java runtime. So when the user uninstalls a 32 bit Java and installs a 64 bit Java instead (Or vice-versa) then my application must still work.
  • Must support large fonts setting of Windows. I don’t really understand this feature. I just know that some applications ignore it completely, others (Like Google Chrome) are pixel-scaled (Looks really ugly) and others support it by simply using larger fonts as intended (That’s what I want and normally it works. Only the WinRun4J solution mentioned below doesn’t work with it).

Tested solutions

WinRun4J

WinRun4j is an EXE file which launches the Java application. Because the application doesn’t fork a new Java process Windows thinks the EXE file IS the application. So there is no problem with the taskbar. File associations works because the files can be simply associated with the EXE file.

Problems:

  • Doesn’t support large fonts. Application window is pixel-scaled instead (Like Google Chrome).
  • Two different EXE files must be used depending on the installed JRE. So when the 64 bit JRE is installed then the application must be started with the 64 Bit EXE file. When 32 bit JRE ins installed then the other EXE must be used. This isn’t user-friendly because the user doesn’t understand why he must use the 32 bit EXE on a 64 bit operating system when only a 32 bit JRE is installed.

Launch4J

Launch4J creates a 32 bit EXE which launches an external Java process to start the Java application. So unlike WinRun4J it can also start a 64 bit Java.

Problems:

  • Can’t pin the application to the taskbar.
  • System.out.println will not print to console if headerType="gui", regardless if application is started from console.

JAR

On Windows you can simply double click the JAR file to start the application. Installed JRE doesn’t matter, simply works. But…

Problems:

  • Application can’t be pinned to the taskbar.
  • Can’t create a shortcut in the start menu.
  • Can’t associate files with a JAR file.

BAT/CMD

A simple batch file like this can be used to start the application:

@echo off
start c:\windows\system32\javaw.exe -jar "c:\program files\myapp\myapp.jar" %1

A shortcut can be created for this batch file to set a custom icon.

Problems:

  • A DOS window pops up when the application is started.
  • The batch file doesn’t know where javaw.exe is located. Depending on which java version (32 or 64 bit) is installed it may be located in c:\windows\syswow64 instead and Windows doesn’t redirect this call from batch files automatically. Using the JAVA_HOME environment variable is also a no-go because Java doesn’t set this automatically.
  • When associating files with the batch file then no custom icon can be set.
  • Taskbar support isn’t working properly. Application can be pinned to it when the batch file is started manually but when double clicking an associated file instead then it doesn’ work.

Shortcut

Instead of using a batch file it is possible to only create a shortcut to start the application. It links to this command: c:\windows\system32\javaw.exe -jar "c:\program files\myapp\myapp.jar". Windows automatically redirects this call to the SysWOW64 directory if a 32 bit Java JRE is installed.

Problems:

  • Not possible to associate files with it because Windows only accepts EXE/COM/PIF/BAT/CMD files as association targets. LNK files don’t work.

Question

Is there another solution which fulfills all the requirements from above? Or are there any tricks to solve the problems with the mentioned solutions?

Solution

After solving the taskbar-pinning problem using Launch4j looks like the best solution. Launch4j can easily be integrated into a Maven project (With this or this plugin), configuration is pretty easy and everything works out of the box except taskbar pinning. For taskbar-pinning the Java application must set an appModelUserId as explained in the answer to this question.

Additionally the Java application must be installed by an installer which must at least install one shortcut pointing to the EXE. This shortcut must also contain the appModelUserId. With NSIS this can be done with the WinShell plugin and a configuration like this:

CreateShortCut "$SMPROGRAMS\MyApp.lnk" \
    "$INSTDIR\myapp.exe" "" "$INSTDIR\myapp.exe" 0 SW_SHOWNORMAL
WinShell::SetLnkAUMI "$SMPrograms\MyApp.lnk" "MyAppModelUserId"

For some unknown reason this shortcut only has to exist. You don’t have to use it. You can double-click the EXE and taskbar-pinning still works. You can even create the shortcut in some subfolder of your application folder. Taskbar-pinning stops working when the last shortcut of the EXE file is removed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:08:47+00:00Added an answer on May 29, 2026 at 11:08 pm

    Try Launch4j (http://launch4j.sourceforge.net/), its a simple jar to exe wrapper (actually wrapping the jar is optional). It should solve your Icon and Taskbar requirements. Its also capable locating installed JRE’s (some configurable rules). The font problem I don’t quite get, Swing should automatically use fonts depending on Windows settings, unless you somehow overwrite that in the JRE options or in code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to publish an application which has these requirements: .NET Framework SQL Server
I'm currently planning to develop a desktop Java application that I might want to
I want to put all the requirements of a repoze Zope2 install in a
If the requirements are changing frequently and you want to deliver your code in
Requirements Project should contain 1 main application and some secondary sub applications (which uses
I want to typeset Mathematical problem-sets in Latex. My requirements are as follows: When
Would QuickGraph be able to help me out with my requirements below? (a) want
We build software using Hudson and Maven. We have C#, java and last, but
I want to allow my users to input HTML. Requirements Allow a specific set
I want to develop a mechanism for search, but I have some requirements for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.