File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes General Computing and the fly likes Modify Windows Service properties using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Reply Bookmark "Modify Windows Service properties using Java" Watch "Modify Windows Service properties using Java" New topic
Author

Modify Windows Service properties using Java

Robin John
Ranch Hand

Joined: Sep 10, 2008
Posts: 270

Hi Friends, How can we modify windows service properties using java ? please see attachments.

I want to modify the "Log On" property to disable the interaction with desktop...



Thanks in advance.



[Thumbnail for service property1.jpg]



Time is what we want the most, but what we use the worst. -- William Penn
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5532

The "Allow service to interact with the desktop" property is a binary flag stored in the Type value for the service in the registry. To see it in action, open regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\xxx, where xxx is any service. Observe the current value of Type. Then change the service with Services control panel and not the flag that is set/unset.

How do you change that in Java? You can't. Unless you can find a Java library that can edit the registry. The most you can hope for is to have Java call an application that can make this change. By the way, it would be easy to write a PowerShell script to make such a change, and it is easy to run PowerShell from Java using System.exec().


JBoss In Action
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Modify Windows Service properties using Java
 
Similar Threads
Windows Service for Java
Accessing file using relative path
How to call oracle reports from JAVA web application
How to check application running on windows machine using java
Property File modification