Bookmark Topic Watch Topic
  • New Topic

How I connect to remote Unix Box from standalone java application?

 
Rudra Narayan Garnaik
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,
Can anybody help me regarding the Unix box connection:
I am going to write a standalone java swing application, here I planned to provide all the unix box details like-IP address/host name, user id and password. I need to read some files from the remote unix server and want to write it to the local machine. All this things I need in Windows platform.

Can anybody give me any idea, how I will connect to unix box from java?

I am waiting for the reply.
 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
The server must provide some service (FTP, HTTP, custom server, network share) that your application can connect to. Once you determine what is available on the server, you know what you need on the client side to connect.
 
Rudra Narayan Garnaik
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
Access is given to me and I able to access that unix box, but how I connect to it from my java application? I need some sample java codes which will connect to my remote server(Unix box).

Please can anybody will help on this....
 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
How do you access it? SSH? Telnet?
 
Rudra Narayan Garnaik
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am accessing my unix box through telnet.

I want to connect to it by giving the userid, password and host ip altogether.
Just look into the below command line:

telnet ://userid assword@host-ip

I am calling this line from java program.
But I unable to connect, it is giving the error:

Connecting To ://uid ass@hostip...Could not open connection to the host, on port 23: Connect failed.

Can anybody suggest me on this?

 
Joe Ess
Bartender
Posts: 9313
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Rudra Narayan Garnaik:
I am accessing my unix box through telnet.


Great. Unfortunately, telnet doesn't have a file transfer capability, whereas SSH does. How about contacting your Unix admin, telling them what you have in mind and seeing what file transfer protocols they support?


I am calling this line from java program.
But I unable to connect, it is giving the error:


Again, you need to Tell The Details. There are many ways to "connect" to a remote server, each with it's own pitfalls. Without knowing the details of what you are doing, we can't help.
 
Rudra Narayan Garnaik
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
Guys finally I got the solution for this issue:
Ist download the plink.exe from google search.
set the classpath for that.
The details are written as below:
------------------------------------------------
set CLASSPATH=%CLASSPATH%;lib\plink.exe;
plink -ssh -l userid -pw password -P 22 hostname
------------------------------------------------

If you unable to get the plink.exe then write to me so that i will help.
 
Koushik Paul
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
Joe Ess wrote:The server must provide some service (FTP, HTTP, custom server, network share) that your application can connect to. Once you determine what is available on the server, you know what you need on the client side to connect.


I have the same requirement, I am using ftp,

I am able to fecth a file, but I need to fire some simple commands before fetching the file.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12186
34
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
what do you mean by "simple commands"? FTP doesn't let you do much - by design. you can cd to different directories (assuming you have permission), you can get directory listings, you can delete files on the remote host (again, assuming you have permission). As far as I know, that's about it.

What EXACTLY are you trying to do?
 
Rob Spoor
Sheriff
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Fred, Paul has posted this question in a better form at http://www.coderanch.com/t/652439/java-io/java/connect-remote-Unix-Box-standalone.
 
    Bookmark Topic Watch Topic
  • New Topic