Eclipse commonly used Development configuration
- 1. Encoding configuration
- 1.1 Chinese garbled output problem < li data-track="4">1.2 Java files are garbled in Chinese
- 2. Switch JDK and modify JRE
- 3. Error: Main class cannot be found or cannot be loaded
- 4. Modify font size
- 4.1 Modify the font size of the editing window
- 4.2 Modify the font size of the compiler
- 5. Create a new Java project
- 6. Import project
- 6.1 Import git
- 6.2 Import existing Java projects
- 7. Run Chinese garbled code
1. Encoding configuration
After importing some Eclipse projects, there will be Chinese garbled problems in the source code. At this time, we need to modify Eclipse encoding settings.
1.1 Chinese garbled output problem
ClickWindows→ General→Workspace Select UTF-8
1.2 Java file with Chinese garbled characters
Required inWindows→General→Content Types→Text→Java Source File
Then change it to GBK or at the bottom UTF-8, just apply it and check whether the page has changed.
2. Switch JDK and modify JRE
Maybe the local JDK is too high. Modify the JDK for further development.
Modify the JRE configuration at this time. Finally, don’t forget to modify the Java compiled version~
After modifying the JRE, we also need to modify the compiled version, select The version you specify is sufficient.
3. Error: Main class cannot be found or cannot be loaded
Because the module information is added when creating it, it can be deleted.
4. Modify font size
4.1 Modify the font size of the editing window
Windows→General →Colors and Fonts→ Basic→Text Font→Edit
Choose what you want Just the font size.
4.2 Modify compiler font size
Windows→General→Colors and Fonts→ Structured Text Editors →Structured Text Editor Text Font→Edit
5. Create a new Java project
File→New→Java Project
6. Import project
File→Import
6.1 Import git
Then find your Git project and copy the url
The last one must be selected here, otherwise there will be problems with the first two.
After importing, you need to modify the project structure:
Right-click Project, then click Properties, click Project Facets, check Java, and pay attention to the later version~
After checking Java and version, you need to check Runtimes on the right Select the JDK you set,
and click the bottomFurther configuration available
If you can’t run it by right-clicking, you need to copy the code to span> Under the src/main/java folder, pay attention to the package!
If it is a normal project, there is no need to copy the code to the specified directory.
6.2 Import existing Java projects
Click File→Import
Existing Projects into Workspace under General
Select the corresponding item.
If the imported project above does not have a Finish project, it means it has not been recognized. It is a Java project. You need to create a new Java project,
and then copy the code into it:
At this time, an error will appear. You need to click on the error message, and then Just double-click to add the package.
Then right-click, Run as→Java Application
7. Run Chinese garbled characters
Sometimes, the interface after running is garbled, as follows:
At this time you need to modify the running configuration:
Right-click the source code →Run As→Run Configurations
Then find Arguments and enter in VM arguments:-Dfile.encoding=gbkThen click Run.
This is not necessarily gbk, you can change it to utf8, gb2312 and try it.
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Eclipse-chang-yong-kai-fa-pei-zhi.html
评论列表(196条)
测试