Solved

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

Posted on 2009-03-30
1
583 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 500 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

Suggested Solutions

Title # Comments Views Activity
'exit' is not valid keyword in java 14 163
spring example errors 33 505
thymeleaf natural templating vs JSP 2 166
collection output issue 9 68
This article was originally published on Monitis Blog, you can check it  here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sour…
Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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