This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
vkrishna krishna
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20497
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vkrishna krishna
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Binary mode does the right thing for text files - you can (and should) always use it.
 
vkrishna krishna
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20497
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic