Usually when using the Eclipse development program, normally it is not a problem to run in Linux, the most obvious is the coding problem, this is generally unified for utf-8, and also the Windows and Linux line break different reasons, There are contemporary code uploaded to GitHub and other platforms, view indentation will be chaotic, so these places need to unify, to Linux as standard, because it is more concise, all the code in addition to UTF-8 encoding, do not use tab indentation, it is recommended to uniformly use 4 spaces or 2 spaces indent, The line-wrapping style is all Linux/unix style, \ n, which guarantees most code compatibility issues, which are set in eclipse
Set all in the top menu bar "window", "Preferences" action
1. Set Indent to 4 spaces
In the dialog box, select "General", "Editors", "Text Editors"
In the right displayed tab width: text box you can see the default is 4, and then at this point in the Insert spaces for tabs box before the tick, indicating that the tab to a space, now is exactly 4
After you save these settings, do not move, click OK to confirm
2. Set Java indent to 4 spaces
The above settings are for normal files, but also for Java source files to set their indentation style
Select Java, Code Style, Formatter, then click Edit on the right ... Go to the Edit screen
First Set tab policy: For spaces only the default is tabs only is the tab indentation, and then modify the profile name can not be saved, after setting these two, save
3. Set encoding and line wrapping style
Select "General", "Workspace", which defaults to default (GBK) in the right text file encoding, this place must be modified to other UTF-8
Then new text file line delimiter is default (Windows) is recommended to modify to other Unix and then determine
Note: The utf-8 here is not with the BOM head, which is pure
After modifying the above 3 items, the cross-platform compatibility problem with the code basically solves
Compatibility configuration with Eclipse development