Hair loss diary tool IDEA (summary of common problems, configuration summary) is very detailed and comprehensive, a must-have help learning manual for beginners, it is recommended to have one copy

This is a summary of the various problems, pits and problems I encountered when I started using idea to learn Java. It is convenient for you to quickly check and solve when you encounter the same problem in the future. In addition, the reasonable configuration of idea can greatly improve the programming speed and learning efficiency.
Continuing to update~~

idea tool use notes

1.《显示工具栏》 view ->appearence->tool bar
2.module的删除 右键remove module 再右键 delete
3.《显示工程结构》 Ctrl+ shift+alt+s

1. Regular placement

​ 1.settings location File->settings
​ 2. Guide package settings settings ->general ->auto import
​ 3. Set file encoding Code Style ->File Encodings UTF-8
​ 4. Automatically compile Build,Exception,Deployment -》 Compiler Check the BC two items
​ 5. Power saving mode: close the related prompt function File -> power
​ 6. The shortcut key is set to the same function of ecplise keyMap - "
​ 7. After entering the Settings interface, click Keymap, and then on the right Click Main menu->Code->Completion->Basic alt+/
​ 8. Set Author: settings ->editor ->File and Code Templates ->Includes FileHeader;

2. Common shortcut keys

​ 1. Execute the current file Ctrl +shift +F10
​ 2. Quick completion alt +/
​ 3. Single-line comment Ctrl+/
​ 4. Multi-line comment Ctrl+shift+/
​ 5. Copy a line down Ctrl+alt+
down 6. Move a line down/up alt+ down/up
​ 7. Ctrl+left click (view source code)
​ 8. Universal error correction/generate return value variable alt+enter
​ 9. Return to the editing page alt +left/
right 10. View inheritance relationship F4
​ 11. Format code Ctrl+shift+f
​ 12. toString() construct get set method alt+insert
​ 13. Generate try catch alt+shift+z
​ 14. Strengthen for loop iter
​ 15 , list.for
​ 16, ifn =>if(xxxnull)

3. web

​ New project add Framework web application
​ Run->edit Config -> set
path

Tomcat 部署 Run->edit Configurations ->+ Tomcat 

Fourth, connect to the database

​ On the right database +
​ Error occurs after normal input
​ Add after url: ?serverTimezone=GMT%2B8

5. Problems

1)文本框出错	File | Settings | Editor | Inspections | HTML | Accessibility | Missing associated label

2)IDEA软件默认端口号63342修改位置	file->settings->build->debugger->build-in-server->port 8080端口被占用 则使用8081

3)出现servlet.api.jar	File ->project structure ->libratity ->Tomcat 里的servlet api

4)表单路径问题
		<form action="/myWeb/useradd" method="get">
			<input type="text" name="username" />
			<input type="submit" value="提交"/>
		</form>

5)404错误 :检查配置路径  web下放文件  WEB-INF lib下放jar包

6)run 按钮点击不了 :没有导入JDK Project Structure SDKS +JDKhome path

7)将工程打包成jar包 
		File->Project Structure ->Artifects 点击+号,选择jar文件中的Empty选项
		在Name 中修改jar 文件的名字,点击下方的CreatManifest 点击OK
		点击Main Class 右侧文件夹图标,选择当前工程的入口类,即主函数类点击 OK
		在AvailableElements 双击编译后的资源文件,将其打入左侧的jar包
		点击Build 选项中的BuildArtifacts 点击Build.
		进入jar包所在的目录,在地址栏输入cmd,java -jar jar包名.jar 	

	File->Project Structure ->Artifects 点击+号,选择jar文件中的from Module 选项

	JAR files from libraries
	勾选 copy to the output	OK

8)
	Maven 
		file -setting - buildException - maven - run :VM 里  -DarchetypeCatalog=internal
		如果添加resources 右键  add as  resources root
9)Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings
	解决办法
		settings ->
		搜索HTTP Proxy–>勾选Automatic proxy configuration URL:
		–>输入https://start.spring.io–>点击Auto-detect proxy settings
		–>输入https://start.spring.io -->点击ok;

		更改check connection - ->  https://start.spring.io

		或者
		不选择默认的Default,而是适用Custom,输入aliyun的镜像节点:http://start.aliyun.com

10)
	1.快捷键ctrl+shift+alt+s,点击Project Settings -> Libraries ,全删.	
	2:删除之前产生的target包;之后点击屏幕右侧的Maven Projects;找到Lifecycle 点击install;
	3:然后点击刷新

11)P19-21中有一个把文件打包到META-INF的操作,使用gradle的小伙伴如果不会设置target,请在build.gradle最后面加上:
	processResources {
	  from('src/main/webapp') {
	  into 'META-INF/resources'
	  include '*.*'
		 }
	}

12)P29,SpringBoot与MyBatis整合,如果有xdm遇到了“Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.”的错误,可以在百度上搜索,也可以参考这篇博客:https://blog.csdn.net/m0_46261993/article/details/108065027

13)Maven 不见了 
		Ctrl + shift +A  搜索 Maven

14)如果install 失败 ,那么查看配置Maven 的路径

15)添加依赖报错
		解决办法 关闭 settings -> build -> maven work online

16) html中 th: 报错
修改:
加入命名空间即可
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

17)idea databse “Driver files are not downloaded” 情况解决:
	
	Driver-->go to Driver --> 设置成自己的

18)MySQL 设置时区

1. 查看时区命令

mysql -uroot -p 
show VARIABLES like '%time_zone%';
  set global time_zone = '+8:00';
  19)
	Caused by: org.apache.ibatis.executor.result.ResultMapException:
 Error attempting to get column 'username' from result set.
  Cause: java.sql.SQLException: Invalid value for getInt() - '王六'
注意 mybatis pojo中要有无参构造,否则就会报这个异常

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324065527&siteId=291194637