Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

code needed for start,stop the remote service

 
vinayaga moorthi
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21003
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
vinayaga moorthi
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21003
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21003
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21003
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. i know the NEt command. i don't know how to execute that command in java.

Vinay
 
Henry Wong
author
Marshal
Pie
Posts: 21003
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic