• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there any api in java to connect to windows using java from unix machine

 
Nevin kumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,

From the java application which is running on a unix box, need to connect to windows machine and need to do some file operations.


Any help highly appreciated.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, exactly, does "connect" mean - by which means? Maybe FTP or SFTP would be sufficient?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or if both systems are connected by a Windows network, then jCIFS might suit your requirements.
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Samba allows a Linux box to connect to a windows box so that you can see the Windows file system on a Linux box. Does your version of UNIX support Samba? If you can install Samba, then you can use the regular Java file support. I'll bet you will have more trouble with your IT department than you have with developing your application :)
 
Nevin kumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Ulf,

When I say connect I mean should be able to access windows from unix machine using a java program.Sometime back I used a ssh client (SFTP connection) for connecting from one mac book to other but I forgot the api .May you suggest any open source and free java api which will full fill my requirement.

@Paul

I need to check whether both the systems are connected in windows Network.



Guys, Thank you very much for your time.
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most important question still remains, what do you want to do? Execute commands? Read and write files? Something else?
 
Nevin kumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Rob,

I need to access a particular folder and check how many files are present and get their names and check the file size of each file not zero.some type of file operations.


 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then use Samba (or Windows file sharing), either with File (you may need to mount the share first) or using jCIFS.
 
Nevin kumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had used an open source ssh client api in java.I was successfully able to connect to linux box from windows machine,but when I tried connecting to windows from unix box.It says connection refused.I had no idea what is the problem ?I had given hostName, userId and password.Any suggestions highly appreciated.


java.net.ConnectException: Connection refused


 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you opened your Windows box appropriately to the network? (File sharing, firewalls, etc).
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To use SSH you'll need to run an SSH server, and there aren't many SSH servers available for Windows. More importantly, they are never ever installed by default, you'll have to do that yourself. But why not follow the advice you've been given at least twice and use JCIFS in combination with a file share on the Windows machine?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic