You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac OS下IntelliJ运行Scala程序报错,寻求技术解决方案

Fixing "No such file or directory" for Java Executable in IntelliJ 2017.3 + Scala

Hi Rahul, sorry to hear you're hitting this roadblock on your first Scala project—let's break down how to fix this error step by step. The core issue here is that IntelliJ is trying to run a Java executable at a path that doesn't exist (or is inaccessible). Here are the most effective fixes to try:

1. Verify & Fix IntelliJ's JDK Configuration

First, let's make sure the JDK IntelliJ is pointing to actually exists:

  • Open IntelliJ and go to File > Project Structure (use the shortcut Cmd + ; on Mac if that's faster).
  • Switch to the SDKs tab in the left sidebar.
  • Look at the path listed for your configured JDK—it should match the one in your error: /Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home.
    • If this path doesn't exist in Finder, the bundled JDK that came with your old IntelliJ 2017.3 install is likely corrupted or missing.
    • Replace it with a locally installed JDK (stick to JDK 8 or 10, since 2017.3 doesn't support newer JDKs well). To add a new SDK, click the + icon at the top left, select JDK, and navigate to the folder where you installed Java (e.g., /Library/Java/JavaVirtualMachines/jdk1.8.0_XXX.jdk/Contents/Home).

2. Clear IntelliJ's Compile Cache

The error mentions the compile-server cache directory, which might be holding stale or corrupted data:

  • Close IntelliJ completely.
  • Open Finder, press Cmd + Shift + G, and paste this path: /Users/rahulghadge/Library/Caches/IdeaIC2017.3/compile-server
  • Delete the entire compile-server folder.
  • Alternatively, you can do this from within IntelliJ (before closing it) by going to File > Invalidate Caches / Restart, then selecting Invalidate and Restart—this will clear all cached data and restart the IDE.

3. Check Module-Level SDK Settings

Sometimes the project-level SDK is correct, but individual modules might still point to the missing JDK:

  • Go back to File > Project Structure > Modules.
  • Select each module in your Hello World project, switch to the Dependencies tab.
  • Look for the Module SDK dropdown—make sure it's set to the working JDK you configured in step 1.

4. Validate System Java Installation

Double-check that your Mac has a working Java installation outside of IntelliJ:

  • Open Terminal and run java -version.
  • If this command throws an error, you'll need to install a compatible JDK first. Install a stable version like JDK 8, then repeat step 1 to point IntelliJ to this new installation.

A quick note: IntelliJ IDEA 2017.3 is quite old, so using newer JDKs (like 11+) might cause unexpected issues. Sticking to JDK 8 will give you the most stable experience with this IDE version.

内容的提问来源于stack exchange,提问作者Rahul Ghadge

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:34:04