javawindowsrmijnajava-service-wrapper

How to use Java RMI to control a desktop window from a Windows Service?


I am having the same problem with this one > Using Java Service Wrapper GUI to interact with desktop on windows

I am currently using Java Service Wrapper to wrap my Java program into a Windows Service. It has a requirement to get hold of an open Window and control it (i.e. press buttons).

I have made it an interactive service and even installed it as an admin user and still no success.

I am using JNA library to get the Windows instance which always returns null if it is running as a service but successful when triggered manually.

hWnd = User32.INSTANCE.FindWindow(0, targetWindowTitle);

One comment in that thread says , it needs to use Java RMI. Do we have examples on how to do it? Thanks!


Solution

  • I am afraid that is not possible for security reason.

    Take a look at the Java Service Wrapper wrapper.ntservice.interactive property documentation at https://wrapper.tanukisoftware.com/doc/english/prop-ntservice-interactive.html