打开idea弹出 java.net.BindException: Address already in use: bind报错怎么解决?

图片说明
打开idea弹出这个报错怎么解决?

解决方案

可以看一下上面的内容,希望可以帮到你
QUICK FIX:

Run the following commands to reset the dynamic port range to what it should be and reboot - this should fix things until Windows messes up the dynamic port range again. This is only for ipv4. I haven't looked at ipv6, but I'd assume it's similar.

netsh int ipv4 set dynamicport tcp start=49152 num=16383
netsh int ipv4 set dynamicport udp start=49152 num=16383

问题来源:

hypervisior(Windows 10的Hyper-V虚拟机),把端口保留了

IDEA需要在端口6942~6991间找到一个可用端口并绑定(bind)
类似问题:
IDEA官网问题:https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004973960-Critical-Internal-Error-on-Startup-of-IntelliJ-IDEA-Cannot-Lock-System-Folders-
类似问题:https://github.com/docker/for-win/issues/3171

禁用hyper-v(可能回重启几次)
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

当你完成所有必需的重启,保留你想要的端口
netsh int ipv4 add excludedportrange protocol=tcp startport=50051 numberofports=1

重新启用hyper-V(可能回重启几次)
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

原解决方法链接:https://github.com/docker/for-win/issues/3171

地址已经被绑定啦,请查看一下对应的发布地址以及端口有没有被占用

这种问题一般都是端口被占用了 查一下你要启动项目的端口 是不是已经开启了

换个端口,或者重启一下

程序要用的端口已被使用,要么修改程序使用的端口号,要么去把使用这个端口号的进程杀掉