• Post Reply Bookmark Topic Watch Topic
  • New Topic

TelnetClient to login to a unix box from another unix box via java code  RSS feed

 
nishant aroras
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to run a command i.e. "ps -ef | grep runmqlsr" on a unix box from another unix box(where java code resides in a jar format). I want to run the command and print out the output. I'm able to connect to the desired box using telnetClient.connect() method. Now, what should I do? Could someone please suggest me something?
Thanks in Advance.


Regards,
Nish
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Apache Commons Net, it has a telnet client.
 
nishant aroras
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using commons-net.jar of apache. but am not able to run the command on 2nd machine which am connecting to
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That library contains only a client, not a server, so the machine into which you want to telnet needs to have a running Telnet server already.
 
nishant aroras
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can I ssh to another machine and try. If yes which client can I use??
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavaIoFaq links to a couple of libraries that implement client-side SSH.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!