设置Eclipse: 开启assertion/设置tab缩进为空格
2017-03-10 10:48
218 查看
这篇文章引自MIT公开课 6.005 — Software Construction on MIT OpenCourseWare, 链接为 https://ocw.mit.edu/ans7870/6/6.005/s16/getting-started/
OS X : go to Eclipse → Preferences .
Go to Java → Compiler and set “Compiler compliance level” to 1.8. Click OK and Yes on any prompts.
In preferences, go to Java → Installed JREs . Click “Java SE 8”, click “Edit…”, and in the “Default VM arguments” box enter: -ea (which stands for enable assertions ).
In preferences, go to Java → Code Style → Formatter . Click the “Edit…” button next to the active profile.
In the new window, change the Tab policy to “Spaces only.” Keep the Indentation size and Tab size at 4. To save your changes, enter a new “Profile name” at the top of the window and click OK.
1 Open Eclipse preferences.
Windows & Linux : go to Window → Preferences .OS X : go to Eclipse → Preferences .
2 Make sure Eclipse is configured to use Java 8
In preferences, go to Java → Installed JREs . Ensure that “Java SE 8” or “1.8.0_71” is the only one checked. If it’s not listed, click Search.Go to Java → Compiler and set “Compiler compliance level” to 1.8. Click OK and Yes on any prompts.
3 Make sure assertions are always on .
Assertions are a great tool for keeping your code safe from bugs, but Java has them off by default.In preferences, go to Java → Installed JREs . Click “Java SE 8”, click “Edit…”, and in the “Default VM arguments” box enter: -ea (which stands for enable assertions ).
4 Tab policy .
Configure your editor to use spaces instead of tabs, so your code looks the same in all editors regardless of how that editor displays tab characters.In preferences, go to Java → Code Style → Formatter . Click the “Edit…” button next to the active profile.
In the new window, change the Tab policy to “Spaces only.” Keep the Indentation size and Tab size at 4. To save your changes, enter a new “Profile name” at the top of the window and click OK.
相关文章推荐
- Eclipse中Tab的配置(设置为按一下Tab键,效果是按4次空格,而不是4个空格的缩进)
- Eclipse中Tab的配置(设置为按一下Tab键,效果是按4次空格,而不是4个空格的缩进)
- vim中缩进的设置以及将tab转换成空格 .
- Source Insight怎样设置tab为四个空格,然后设置自动缩进
- eclipse中用空格(space)代替"制表符(tab)的设置
- Eclipse设置Tab键为空格
- Office2007/2010输入四个空格自动转换为Tab(缩进)功能设置
- eclipse中用空格(space)代替"制表符(tab)的设置
- [摘]Eclipse中用空格(space)代替制表符(tab)的设置
- Eclipse 设置按Tab键为4个空格
- Eclipse中显示空格(Space)和Tab符的设置
- Eclipse设置软tab(用4个空格字符代替)及默认utf-8文件编码(unix)
- Eclipse 的 Tab 和空格,UTF-8 设置
- Eclipse设置软tab(用4个空格字符代替)及默认utf-8文件编码(unix)
- Eclipse设置软tab(用4个空格字符代替)及默认utf-8文件编码(unix)
- Eclipse中Tab设置为4个空格
- Eclipse设置软tab(用4个空格字符代替)及默认utf-8文件编码(unix)
- vim 之自动缩进(smartindent) tab 空格数设置为4
- eclipse中用空格(space)代替"制表符(tab)的设置
- vim中缩进的设置以及将tab转换成空格