• Post Reply Bookmark Topic Watch Topic
  • New Topic

Best way to connect to another server to read in a file?  RSS feed

 
steve kelly
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I need to be able to read in a log file using BufferedReader from my app when a user clicks on a button. But I need to connect to another server to get this file. Whats the best approach for this? I'll have the port#, logins/passwords/path locations etc etc- just need a direction to take(i.e. what classes etc). thanks
 
steve kelly
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh and its a solaris server if that matters
 
K. Tsang
Bartender
Posts: 3633
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just curious wouldn't using shell script be faster and simpler than using java?

ssh user@ip 'cat /absolutepath/filename'
 
steve kelly
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
probably but wanted to link up to a button in one centralized location for support users that are not that saavy
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Runtime.exec or ProcessBuilder to kick off an scp command (rather than ssh) to copy the file to the local machine, and then process it any way you like.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!