Execute a jar file ever Windows initialize and after the user logon (Not as a Service) that call a process with a GUI

huangapple 未分类评论54阅读模式
英文:

Execute a jar file ever Windows initialize and after the user logon (Not as a Service) that call a process with a GUI

问题

我有一个.jar文件,我想将这个文件作为一个服务来运行。当这个.jar文件执行时,它会打开另一个程序,我希望能够看到它的图形用户界面(GUI)。但请注意:只有第二个程序需要GUI(.jar文件不需要)。我使用以下方式打开第二个程序:

ProcessBuilder processBuilder = new ProcessBuilder(cmdCommand);
processBuilder.redirectErrorStream(true);
Process process = processBuilder.start();

在搜索这个问题时,我发现如果我将我的.jar文件作为一个服务运行,由于自Windows Vista以来,服务在另一个桌面上执行,所以我无法看到启动的GUI。为了创建一个服务,我使用了Java Service Wrapper。在这个教程中,他们教如何使用wrapper.ntservice.interactive配置来使服务显示GUI。他们还提醒道:

从Windows Vista和Server 2008开始,微软改变了服务与桌面交互的方式。出于安全原因,他们决定现在只允许服务在只有服务可以与之交互的特殊桌面上显示其GUI。不幸的是,这使得交互功能几乎无法使用。我们正在寻找以不同方式显示GUI的方法。请继续关注。
如果您在互联网上使用“Interactive services dialog Vista”关键词进行搜索,您会找到有关Windows在服务桌面上的GUI更新时如何在用户桌面上显示对话框的许多参考资料。
这是为什么在Windows中禁用这个功能的一些重要安全原因。但是,如果您确实需要重新启用此功能,可以通过编辑Windows注册表并将HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveServices设置为0来实现。在编辑注册表时要非常小心,因为更改错误的值可能会破坏您的系统。”

我尝试将NoInteractiveServices配置为0,但仍然不起作用。

那么,我如何在Windows启动时和用户登录时执行一个.jar程序,并仍然能够看到我打开的进程的GUI呢?

英文:

I have a jar file and I wanted to run this file as a service. When this .jar executes, it opens another program that I want to be able to see it GUI. But note: only the second program needs a GUI (the .jar not). I open this second program using the following:

ProcessBuilder processBuilder = new ProcessBuilder(cmdCommand);
processBuilder.redirectErrorStream(true);
Process process = processBuilder.start();

Searching about this issue I saw that if I performed my .jar file as a service, I could not see the process started GUI because services executing in another desktop since Windows Vista. To create a service, I used Java Service Wrapper. On this tutorial, they teach how to use the wrapper.ntservice.interactive configuration to make for the service to display a GUI. They alert too:

"Starting with Windows Vista and Server 2008, Microsoft changed the way services are allowed to interact with the desktop. They decided that for security reasons, services are now only allowed to show their GUI on a special desktop that only the service can interact with. Unfortunately, this makes interactive features pretty much useless. We are looking into ways to display a GUI in a different way. Stay tuned.
If you do a search on the Internet with keywords of "Interactive services dialog Vista", you will find a number of references to the way Windows will display a dialog on the user desktop whenever a service has updated into GUI on the services desktop.
There are some important security reasons why this was disabled in Windows. But if you really need to reenable this functionality, it is possible to do so by editing the Windows Registry and setting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\NoInteractiveServices to 0. Always be very careful editing the registry as you can easily mess up your system by changing the wrong values.
"

I've been tried to configuration the NoInteractiveServices to 0, but yet do not work.

So, how can I execute a .jar program when windows initialize and the user do the login, and still be able to see the GUI of my opened process?

huangapple
  • 本文由 发表于 2020年4月7日 04:48:06
  • 转载请务必保留本文链接:https://java.coder-hub.com/61068715.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定