IntelliJ IDE更新后新建类无法打开,新建包后创建类报错求助
Hey there, let's work through these annoying post-update glitches in IntelliJ—they’re super common, so we’ll get you sorted quickly!
Step 1: Invalidate Caches & Restart
This is the first go-to fix for almost any weird IntelliJ behavior after an update, since corrupted caches are usually the culprit:
- Go to
File→Invalidate Caches... - Check the box for "Clear file system cache and local history"
- Click
Invalidate and Restartto let IntelliJ reset its cache files and reboot.
Step 2: Verify Project SDK Configuration
Updates sometimes mess up your SDK settings, which can break class creation entirely:
- Open
File→Project Structure(or pressCtrl+Alt+Shift+S) - Under Project Settings > Project, double-check that
Project SDKandProject Language Levelmatch your installed JDK version (e.g., Java 17 if that's what you're using) - Head to Modules next, and confirm each module has the correct SDK assigned too. If not, click the dropdown and select your JDK path.
Step 3: Reset Project Configuration Files
Corrupted .idea or .iml files can cause all sorts of odd behavior. Here's how to reset them safely:
- Close IntelliJ completely
- Navigate to your project's root folder
- Delete the
.ideafolder and any.imlfiles (pro tip: back up therunConfigurationsfolder inside.ideafirst if you have custom run settings!) - Reopen your project in IntelliJ—it’ll automatically rebuild these configuration files from scratch.
Step 4: Check Plugin Compatibility
Outdated or incompatible plugins often break things after an IDE update:
- Go to
File→Settings→Plugins - Disable all third-party plugins (leave official JetBrains plugins enabled)
- Restart IntelliJ and try creating a new class/package again. If it works, re-enable plugins one by one to find the problematic one—either update it to the latest version or uninstall it if it’s no longer supported.
Step 5: Repair the IDE Installation
If none of the above works, the IDE itself might have corrupted files from the update:
- Press
Ctrl+Shift+Ato open the Find Action menu - Search for
Repair IDEand select it - Follow the on-screen prompts to let IntelliJ scan and fix any damaged installation components.
Note on the "Enter Image Description Here" Error
This weird error message usually pops up when IntelliJ’s UI cache is broken, so the steps above (especially invalidating caches or resetting config files) should resolve it. If it still shows up, double-check that your package/class names don’t have special characters or spaces—stick to valid Java naming conventions (lowercase for packages, CamelCase for classes).
内容的提问来源于stack exchange,提问作者Disha Namdev

