This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes problem while moving the java project from windows environment to FreeBSD in ASCII mode. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "problem while moving the java project from windows environment to FreeBSD in ASCII mode." Watch "problem while moving the java project from windows environment to FreeBSD in ASCII mode." New topic
Author

problem while moving the java project from windows environment to FreeBSD in ASCII mode.

vkrishna krishna
Greenhorn

Joined: Feb 11, 2009
Posts: 7
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.

Thanks,
krishna.p
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
vkrishna krishna
Greenhorn

Joined: Feb 11, 2009
Posts: 7
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.

Thanks,
krishna.p
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
Binary mode does the right thing for text files - you can (and should) always use it.


Ping & DNS - my free Android networking tools app
vkrishna krishna
Greenhorn

Joined: Feb 11, 2009
Posts: 7
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.

Thanks,
krishna.p
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem while moving the java project from windows environment to FreeBSD in ASCII mode.