?
Solved

How can I stop and start a windows service from java code

Posted on 2009-03-30
1
Medium Priority
?
588 Views
Last Modified: 2012-08-13
Dear all,

I want to write a Java program that start and stop a windows service on my local machine and also on some servers on the network. I have Windows Server 2003 as operating system.

Thank you,

Ayad
0
Comment
Question by:Alqershi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
basav_com earned 2000 total points
ID: 24020606
You can start and stop the services from command prompt using:
net start <ServiceName>
http://www.ss64.com/nt/net_service.html

Use the  Runtime.exec() method to call this from java / Place the start & stop commands in .bat file and call this .bat file using Runtime.exec().
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Summer 2017 Scholarship Winners have been announced!
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question