aspose file tools*
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 Java 8 in Action this week in the Java 8 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: 19552
    
  16

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: 39571
    
  27
Binary mode does the right thing for text files - you can (and should) always use it.


Ping & DNS - updated with new look and Ping home screen widget
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: 19552
    
  16

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem while moving the java project from windows environment to FreeBSD in ASCII mode.
 
Similar Threads
can i use java to backup user profiles
Which mode shoud be used for jsp? ascii or binary
how to make the java application developed in windows environment work on FreeBSD?
Suggestions for an IDE
Remove ^M character in text file