0

I am new to java. Before I get straight to the point, let me introduce to you where I currently am. Sorry for the long story.

I made a packaged installer for my app with jpackage. I packaged a simple hello world program for the first time, just to test the jpackage command. Once it produced the packaged installer, I installed my hello world program with it.

Then I went to C:\Program Files\Hello World and then executed the HelloWorld.exe file.; but nothing happened. To debug the issue, I rebuilt the HelloWorld.jar file with an infinite loop at the end. Then I repackaged and reinstalled the program again. Then I ran the HelloWorld.exe again.

However, this time I saw a blue circle at my mouse's cursor for quite some time. So I opened task manager scrolled down, and then I found the HelloWorld program running in the list of background processes! Here is a screenshot:

screenshot of task manager

So, this is my question: Why is my java application, which I created with a packaged installer created by packaged, running in the background? Why isn't it opening any console windows?

EDIT: I forgot to include the command that I used to create my packaged installer. Here it is:

jpackage -t exe --name HelloWorld --input D:\Fida\Codeblocks\Java\Projects\HelloWorld\dist --dest D:\Fida\CodeBlocks\java --main-jar HelloWorld.jar --module-path "C:\Program Files\Java\jdk-16.0.1\jmods" --add-modules java.base --description "Hello World Program" --app-version 1.0.0 --vendor Fida --icon D:\icon_file.ico --copyright Fida --win-shortcut --win-menu

1 Answers1

4

In order for a console to be shown when running the application, you must add the --win-console option when invoking jpackge:

Platform dependent option for creating the application launcher:
  --win-console
          Creates a console launcher for the application, should be
          specified for application which requires console interactions
Jorn Vernee
  • 31,735
  • 4
  • 76
  • 93