idea立即检查java错误,IntelliJ IDEA中的自动错误检测

I am new to Java programming language and the IntelliJ IDEA 2017.1 IDE.

I just installed the IDE and I activated all the various inspections but the IDE is unable to detect the errors any time I make a mistake such as omitting a bracket or a semicolon.

This image displays the activated inspections:

JFnPU.png

This is a screenshot of my code with multiple errors but no detected by the IDE:

zPfeK.png

Kindly help me solve this problem.

解决方案

Java file is not analyzed since it's located outside of the source root. You need to either relocate the file or reconfigure your content roots so that it resides under the folder configured as the Sources root.

Sources root is marked in blue in the project view. Here is the example of the properly configured project (notice the class icon is different than on your screenshot):

Z2T3q.png

RgIyI.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
IntelliJ IDEA 检查 Java 配置(也称为 Build Configuration)通常涉及以下几个步骤: 1. **打开项目**: 打开你正在工作的 IntelliJ IDEA,然后选择 "File"(菜单栏)> "Open"(或者使用快捷键 `Ctrl+Shift+N`),找到并选择你的 Java 项目。 2. **进入模块设置**: 在项目结构窗口,找到你想检查配置的模块,右键点击它,选择 "Module" > "Properties"(或 `Ctrl+Alt+O`)。 3. **查看 Build 面板**: 展开 "Build, Execution, Deployment" 标签,你会看到 "Project Structure" 部分,其有一个 "Modules" 部分。在这里,你可以看到 "Facets"(如果项目使用了模块化)、"Compiler"、"Compiler Output"、"Dependency" 等选项。 4. **检查 Compiler 设置**: 在 "Compiler" 选项卡下,确认 "Language level"(语言级别)是否设置正确,以及 "Annotation Processors" 和 "Module SDK" 是否指向正确的 JDK 版本。 5. **查看 Run/Debug Configurations**: 如果你想检查运行或调试配置,可以在 "Run" 或 "Debug" 面板(通常在同一个 "Build, Execution, Deployment" 区域下)里,选择对应的配置,检查 "Configuration Type"、"Main Class"、"VM Options" 等设置。 6. **检查 Build Path**: 在 "Libraries" 或 "Content Roots" 选项卡,确认项目的依赖库和源代码路径是否正确。 7. **查看 Modules' Settings**: 在 "Project Structure" 窗口,单击 "Module Settings" 可能会看到更多的配置选项,如 "Source"、"Resources" 和 "Test Sources"。 8. **检查错误和警告**: 如果 IDE 提示任何编译错误或警告,它们通常是配置问题的线索,需要你修正这些错误
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值