Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
How do you access it? SSH? Telnet?
 
Rudra Narayan Garnaik
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13073
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 22684
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Fred, Paul has posted this question in a better form at https://coderanch.com/t/652439/java-io/java/connect-remote-Unix-Box-standalone.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic