aspose file tools*
The moose likes Java in General and the fly likes code needed for start,stop the remote service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "code needed for start,stop the remote service" Watch "code needed for start,stop the remote service" New topic
Author

code needed for start,stop the remote service

vinayaga moorthi
Greenhorn

Joined: Jan 31, 2006
Posts: 14
hi friends
i need some sample codings which will start or stop or restart the remote serviceand local service using JMX. help me

advance thanks
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18117
    
  39

Originally posted by vinayaga moorthi:
hi friends
i need some sample codings which will start or stop or restart the remote serviceand local service using JMX. help me

advance thanks


What remote service are you referring to?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
vinayaga moorthi
Greenhorn

Joined: Jan 31, 2006
Posts: 14
I want to control the services which will be run on remote machine.. actually i has to do that a form contains one list box which contains the network machine names in your network . if u click on that machinenames it should list all service ( which will be shown on the task manager in windows) eg. telnet, rpc, any application service..etc... how can i do it?. otherwise give the code for stopping and starting the service for the pc.

thanks for u r reply
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18117
    
  39

All the major application servers -- Weblogic, Websphere, JBoss -- contains a JMX container which you can monitor remotely. For Tomcat, it is optional, but it is possible too. All of these has mbeans that will let you monitor, and control its services remotely. That is the good news.

The bad news? Windows does not provide an independant JMX container. Same is true for Solaris and Linux. Currently, there are no JMX containers running at the OS level -- that I know of. The best you can do at this point is probably install some sort of SNMP agent on the OS, and contact that through Java.

Alternatively, you can also install an application server which has a JMX container on it, but then, all mbeans are specific to the application server. You will still need to obtain or write mbeans that can monitor the local operating system.


In other words, JMX may both be an overkill, and useless for what you are trying to accomplish.

Henry
vinayaga moorthi
Greenhorn

Joined: Jan 31, 2006
Posts: 14
ok but my one my friend told that u can do with NET START and NET STOP command. i dont know how to apply it.


vinay
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18117
    
  39

Originally posted by vinayaga moorthi:
ok but my one my friend told that u can do with NET START and NET STOP command. i dont know how to apply it.


vinay


NET START/STOP are simply commands executed from the command line of a local windows machine to affect a remote windows machine. You can do the same thing (execute those commands) from Java, via the Runtime.getRuntime().exec() method.

Henry
vinayaga moorthi
Greenhorn

Joined: Jan 31, 2006
Posts: 14
i am new to java. i know only core java. now only i learn java by myself. so please send me the sample coding for that NETSTART/STOP. please

vinay
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18117
    
  39

Originally posted by vinayaga moorthi:
i am new to java. i know only core java. now only i learn java by myself. so please send me the sample coding for that NETSTART/STOP. please

vinay


NET START/STOP is *not* java -- its windows. It has been years since I've done it. You might want to search the Microsoft site on the NET command, and the particular service you are trying to affect.

Henry
vinayaga moorthi
Greenhorn

Joined: Jan 31, 2006
Posts: 14
yes. i know the NEt command. i don't know how to execute that command in java.

Vinay
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18117
    
  39

Originally posted by vinayaga moorthi:
yes. i know the NEt command. i don't know how to execute that command in java.

Vinay


You have to use the Runtime.getRuntime().exec() method to execute commands in Java.

Henry
[ February 04, 2006: Message edited by: Henry Wong ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: code needed for start,stop the remote service
 
Similar Threads
Network Adaptor Could Not Establish Connection
NT service monitor
how to run JMX?
Jboss windows service
Start and stop apache service running on a remote server in ANT