Java错误解决记录

  • internal java compiler error
    检查以下配置
    1 查看项目的jdk
    File | Project Structure... | Project Settings | Project | Project SDK: Project language level:
    2 查看工程的jdk
    File | Project Structure... | Project Settings | Modules | 工程名称 | Sources | Language level:
    3 查看idea中Java配置
    Preferences | Build, Execution, Deployment | Compiler | Java Compiler | Target bytecode version
    如不起作用,清除IDEA缓存 重启IDEA
    File | Invalidate Caches/Restart...

  • You aren‘t using a compiler supported by lombok, so lombok will not work and has been disabled.
    Preferences | Build, Execution, Deployment | Compiler
    User-local build process VM options (overrides Shared options):后面添加-Djps.track.ap.dependencies=false

  • @Slf4j找不到log
    Preferences | Build, Execution, Deployment | Compiler | Annotation Processors
    勾选Enable annotation processing
    重启idea

  • pom.xml不可用
    Preferences | Build, Execution, Deployment | Build Tools | Maven | Ignored Files
    取消选中对应项目的pom.xml

  • JDK isn't specified for module '***'
    删除.idea然后刷新一下即可

  • Error:(28, 5) java: No property named "**" exists in source parameter(s). Did you mean "null"?
    错误解释:该错误是使用mapstructlombok结合使用时产生的错误,mapstruct在生成转换代码时找不到属性
    错误分析:原因是因为在生成转换代码时lombok还没有生成setter、getter相应方法,所以找不到属性
    解决办法:在pom.xml中调整顺序lombok放在mapstruct前面编译

  • Web server failed to start. Port 8080 was already in use.
    停掉占用端口的其他Web server,也可以使用下面方法
    Mac系统终端执行

# 查找8080端口占用pid
lsof -i tcp:8080
# `kill`掉
kill 6095
  • Maven创建的Module不能使用依赖库
    IDEA -> Preferences... -> Build,... -> Maven -> Ignored Files -> 勾掉.../pom.xml

  • main/java文件不能创建Java文件
    右击java -> Mark Directory as -> Sources Root
    Process terminated
    在报错的左侧栏里点击项目名查看错误原因并解决
    解决:中文路径导致

  • Error:(28,57) java: -source 1.5 中不支持 diamond 运算符
    pom.xml中指定当前使用的jdk版本


    1.8
    1.8 
    1.8

  • Mac系统idea集成Tomcat出错
    Error running 'Tomcat 9.0.34':Unable to open debugger port (127.0.0.1:xxxxx):java.net.SocketException "Socket closed"
    端口号被占用:调整端口号Startup/Connection -> Debug -> Port
    其他原因:Tomcat安装路径不对导致
    安装Tomcat:https://www.jianshu.com/p/67220b7a2579

你可能感兴趣的:(Java错误解决记录)