Ubuntu16.04下JDK10安装正常但IntelliJ路径选择报错求助
Hey there, let's work through this issue step by step—command line recognizing your JDK but IntelliJ not picking it up is a common hiccup, but easy to fix.
Step 1: Confirm your JDK 10's actual installation path
First, let's make sure you're pointing IntelliJ to the right directory. Run this command in your terminal to get the exact root path of your Oracle JDK 10:
update-alternatives --list java
You should see something like /usr/lib/jvm/java-10-oracle/bin/java—the JDK home directory is the parent of the bin folder here, so that would be /usr/lib/jvm/java-10-oracle/.
Step 2: Double-check your IntelliJ selection
When adding the JDK in IntelliJ, it's easy to accidentally select the bin subfolder or another child directory instead of the root JDK folder. Make sure you navigate to the full path we found above (e.g., /usr/lib/jvm/java-10-oracle/) and select that root directory, not any of its subfolders.
Step 3: Manually add the JDK to IntelliJ's SDK list
If selecting the directory directly still doesn't work, try manually registering it:
- Open IntelliJ and go to
File > Project Structure(or pressCtrl+Alt+Shift+S). - Under
Platform Settings, selectSDKs. - Click the
+icon in the top-left corner and chooseJDK. - Navigate to the confirmed JDK root path (
/usr/lib/jvm/java-10-oracle/) and select it. IntelliJ should now recognize it as a valid JDK 10 home.
Step 4: Verify IDE compatibility
JDK 10 is an older release, so make sure your version of IntelliJ IDEA supports it. IntelliJ IDEA 2018.1 and later versions officially support JDK 10. If you're using an older IDE build, you'll need to upgrade IntelliJ to a version that works with JDK 10.
Step 5: Check directory permissions (if needed)
In rare cases, IntelliJ might lack read access to the JDK directory. If all the above steps fail, run this command to ensure proper permissions:
sudo chmod -R 755 /usr/lib/jvm/java-10-oracle/
Then restart IntelliJ and try selecting the directory again.
内容的提问来源于stack exchange,提问作者mishi

