由打包安装程序(使用 jpackage 创建)安装的 Java 程序在后台运行(不打开任何窗口)-错误 [英] Java program that is installed by a packaged installer (created with jpackage) runs in the background(doesn't open any window) - bug

查看:38
本文介绍了由打包安装程序(使用 jpackage 创建)安装的 Java 程序在后台运行(不打开任何窗口)-错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Java 新手.在进入正题之前,先介绍一下我现在的情况.对不起,故事太长了.

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.

我使用 jpackage 为我的应用程序制作了一个打包安装程序.我第一次打包了一个简单的hello world程序,只是为了测试jpackage命令.一旦它生成了打包的安装程序,我就用它安装了我的 hello world 程序.

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.

然后我去C:\Program Files\Hello World然后执行HelloWorld.exe文件.;但什么也没发生.为了调试这个问题,我在最后用一个无限循环重建了 HelloWorld.jar 文件.然后我重新打包并重新安装了程序.然后我再次运行 HelloWorld.exe.

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.

但是,这一次我在鼠标光标处看到一个蓝色圆圈已经有一段时间了.于是我打开任务管理器向下滚动,然后我发现后台进程列表中运行着HelloWorld程序!这是截图:

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:

任务管理器截图

所以,这是我的问题:为什么我使用 packaged 创建的打包安装程序创建的 java 应用程序在后台运行?为什么不打开任何控制台窗口?

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?

我忘记包含用于创建打包安装程序的命令.这是:

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

推荐答案

为了在运行应用程序时显示控制台,您必须在调用 --win-console 选项时添加<代码>jpackge:

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

这篇关于由打包安装程序(使用 jpackage 创建)安装的 Java 程序在后台运行(不打开任何窗口)-错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆