Avatar of ctoan
ctoan

asked on 

Starting a Windows Service from Java

I have seen a lot of articles on running java applications as windows service. However, I have a different requirement.

I would like to start a Windows service from a java class. Would appreciate code sample to do this.
Java

Avatar of undefined
Last Comment
CEHJ
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You can Runtime.exec the 'net start' command. See

http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Avatar of ctoan
ctoan

ASKER

I have used Runtime.exec in the past to start processes from Java classes.

However, I am not sure how this 'net start' thing is done. Can you please explain ?  Thanks a lot.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of ctoan
ctoan

ASKER

Thanks a lot !
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

:-)
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo