469,291 Members | 1,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,291 developers. It's quick & easy.

How to copy a file from windows to linux using java

Good Day:
as the title says i am creating a program that will copy a file from windows to a linux machine. any help would be appreciated. i tried looking for it on google but i dont see a real help.

a sample code will be a huge help.. ive tried a few times but to no avail and im running out of ideas

thanks in advance
Jul 3 '08 #1
9 9511
r035198x
13,262 8TB
Open a Socket and copy the file as an InputStream.
Jul 4 '08 #2
Open a Socket and copy the file as an InputStream.
Im sorry but i dont know what sockets are... pls help me..
a link to a tutorial on socket programming might help.. or a sample code will extremely help..
Jul 6 '08 #3
JosAH
11,448 Expert 8TB
Im sorry but i dont know what sockets are... pls help me..
a link to a tutorial on socket programming might help.. or a sample code will extremely help..
Take a step back: how are those two machines connected to each other? Can
one machine 'see' the filing system of the other and/or vice versa? If so, you can
simply copy the file from one FS (Filing System) to the other.

If not, does that Linux machine run FTP (File Transfer Protocol)? If so you can
use your FTP client on the other machine to transfer the file.

Does a SMB ("Samba") server run on that Linux machine? If so you can go back
to that step one again and simply copy the file.

Does any service run on that Linux machine that accepts file names and data
and creates a corresponding file and stores the data in there? If so you have to
connect to that service and send it the name and content of your file. This
usually involves sockets.

Is there any wire connected between the two machines? If not, you're out of luck.
Use a USB stick or even floppy disks then.

kind regards,

Jos
Jul 6 '08 #4
If not, does that Linux machine run FTP (File Transfer Protocol)? If so you can
use your FTP client on the other machine to transfer the file.
i guess it runs FTP (Linux)

The machines are connected like this:

im browsing through the web application through IE on a windows workstation

the application is being hosted in a linux platform.

The method im doing is to upload a file from the windows workstation to the linux workstation.

*SCENARIO*
i want to change the picture the front page displays (.../pic1.jpg) .. i then browse and upload a new picture from any terminal (windows for example) and copy it to the directory of the linux.
Jul 6 '08 #5
JosAH
11,448 Expert 8TB
So your Linux machine has a web service available, i.e. the service probably
listens to port 80 for requests. This is old time technology with its myriads of
solutions. Google for "web upload file servlet" and see the results.

kind regards,

Jos
Jul 6 '08 #6
i would look into it thanks


i would also get back here i f i get it done or not..
Jul 8 '08 #7
so far all i have seen are jar files that need to be bought or is only in trial versions... are there open / free web upload file servlet. ?
Jul 9 '08 #8
JosAH
11,448 Expert 8TB
so far all i have seen are jar files that need to be bought or is only in trial versions... are there open / free web upload file servlet. ?
You didn't look close enough: this one is completely free and there are
many more where this came from.

kind regards,

Jos
Jul 9 '08 #9
Good Day ,
Right now i used the uploadPackage.jar that i found . If anyone is familiar on how to use this jar pls help me.
When i upload an image file of any type and upload it or copy it to another pc the image file is broken.. the image is distorted..

this is my configuration.txt:

name=report3.jpeg
dir=c:\
log=c:\
max=100000000
extensions=
reply=/upload.jsp
error=/tryal.jsp
overwrite=1


the max variable is the only thing i think that i should tweak.. However when i changed it from 10000 to 100000000 .. the image gor better but still distorted...

is there anything i could do or is this jar file limited on a uploading a certain kind of file.?

If there are any more suggested jars to use.. pls do so...

As to the oreilly servlets.. im still trying to study how to use it... i saw the demo but i am in the process of making it to work.
Jul 17 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Hal Vaughan | last post: by
48 posts views Thread by Joseph | last post: by
12 posts views Thread by Von Clubusev | last post: by
3 posts views Thread by Igor.Smirnov | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.