Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
default methods vs abstract class 1 118
issue with pdf generation 2 93
spring AOP 6 88
thymeleaf natural templating vs JSP 2 136
This article describes how to reset your Windows 10 password when you've forgotten it.
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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