problem while moving the java project from windows environment to FreeBSD in ASCII mode.
Joined: Feb 11, 2009
Hi All, I have my java project running successfully on Windows environment. Now iam moving this java project folder from windows environment to FreeBSD environment via SSH Secure File Transfer Client in a ASCII mode. now Iam unable to run the project in FreeBSD box. However if i move using Binary mode into FreeBSD box, the project just works fine. i think we should not move the project in binary mode into FreeBSD box because all the lines will be extended with special character like(M). I dont think we should move the project in binary mode into FreeBSD box. is there any thing that im missing. Would appreciate if any of you can help me out in sending the project in ASCII mode. Thanks in advance.
You should use binary mode for binary files, and ASCII mode for text files. Using binary mode for text files does not convert line breaks correctly, and using ASCII mode for binary files may corrupt the files because it could translate bytes you don't want translated.
Thanks for the reply. Actually im new to java technology.
1)In my project how can i know what are all the binary files and what are all the text files?
2)After i have moved binary files in binary mode and text files in ascii mode into Freebsd box, can i retrieve my entire java project from FreeBSD box into windows in binary mode. will there be any glitches? please help me. Thanks in advance.
Joined: Mar 22, 2005
Binary mode does the right thing for text files - you can (and should) always use it.
Thanks for the reply. Binary Mode does the right thing for text files? i think an extra ^M will be added to all lines of that text file. Can you please tell me what are all the binary files and what are all the text files in java project. Thanks in advance.
Binary mode simply copies all bytes exactly as they are. It doesn't add an ^M - that is part of the Windows line break sequence.
Linux and Unix use just \n (line break) as a line break sequence. Windows uses the combination of \r\n (carriage return followed by line break). The ^M is your text editor not being able to cope with the \r part. Similarly, Notepad can't handle the absence of \r; just \n is displayed as a little square, and no line breaks are seen.
Although ASCII file transfer will remove them for you, your web container shouldn't care whether the \r characters are there or not. So using binary transfer will work just fine.
If you really want to get rid of the ^M, you can always use a tool like dos2unix to remove them for you.