• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modify Windows Service properties using Java

 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
service property1.jpg
[Thumbnail for service property1.jpg]
Enable Disable the property
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic