Eclipse and Windows newlines

前端 未结 6 2164
天命终不由人
天命终不由人 2020-11-29 15:43

I had to move my Eclipse workspace from Linux to Windows when my desktop crashed. A week later I copy it back to Linux, code happily, commit to CVS. And alas, windows newlin

6条回答
  •  温柔的废话
    2020-11-29 16:11

    As mentioned here and here:

    Set file encoding to UTF-8 and line-endings for new files to Unix, so that text files are saved in a format that is not specific to the Windows OS and most easily shared across heterogeneous developer desktops:

    • Navigate to the Workspace preferences (General:Workspace)
    • Change the Text File Encoding to UTF-8
    • Change the New Text File Line Delimiter to Other and choose Unix from the pick-list

    alt text

    • Note: to convert the line endings of an existing file, open the file in Eclipse and choose File : Convert Line Delimiters to : Unix

    Tip: You can easily convert existing file by selecting then in the Package Explorer, and then going to the menu entry File : Convert Line Delimiters to : Unix

提交回复
热议问题