• Post Reply 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

writing files form Linux to Windows

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i am trying to upload a file from Linux System(SUSE) and store it in a share folder which is in windows system.I read the uploaded file and write it in the shared folder by normal java.io file. this works when both the systems are windows..but when i upload from a linux machine and store it in a windows machine get file found error
File shareFile=new File("//windowsSystemName/shareFolder");
i guess it is searching from the root folder but not from the network. But the same code works fine for Windows to windows not for Linux to windows
why is this behaving differently?

thanks in advance
Prem
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course this method will not work.
You can just try access //sharedfolder from Linux by hand to see if it works.
In fact,accessing Windows shared folder from Linux ,you need run Samba service
in Linux.You can google it firstly.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

In fact,accessing Windows shared folder from Linux ,you need run Samba service in Linux.


No, you don't. It's the other way around: You'd use Samba to run a Linux file server that looks like a Windows share (and is thus accessible from Windows).

The reason the File class can't be used is that it knows nothing of the SMB protocol that is used to access Windows shares. Luckily, the Samba guys have made available a Java library that does: JCIFS. It's API mimics the java.io classes very closely, so it's easy to convert any file I/O to use it instead.
[ November 28, 2006: Message edited by: Ulf Dittmer ]
 
jeff rusty
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for ur suggestions..
i configured samba and mounted my windows share files in the Linux machine and now i can i view my share files on the linux machine.. but my requirement is to write the files from Linux to Windows through java code.. how can i do it.. or do i need to mount my windows in each an every linux machine and write the uploaded file in the Mounted Windows share

thanks,
Prem kamal
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

how can i do it


Perhaps you missed what I wrote about jCIFS?

or do i need to mount my windows in each an every linux machine and write the uploaded file in the Mounted Windows share


No.
 
jeff rusty
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya i got it thanks
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:

No, you don't. It's the other way around: You'd use Samba to run a Linux file server that looks like a Windows share (and is thus accessible from Windows).

The reason the File class can't be used is that it knows nothing of the SMB protocol that is used to access Windows shares. Luckily, the Samba guys have made available a Java library that does: JCIFS. It's API mimics the java.io classes very closely, so it's easy to convert any file I/O to use it instead.

[ November 28, 2006: Message edited by: Ulf Dittmer ]



yes, you do.
You're talking about the Samba server, which you don't need. But you do need the Samba client (or another SMB client if one exists).
 
jeff rusty
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do i neeed a samba client to make my java code to write a file on a windows share
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't need a Samba client. The Java code that uses jCIFS to access the Windows share is the SMB client that you need.
 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic