Search code examples
javaintellij-ideaplayframework-2.0

In Intellij IDEA 14.1.4: Cannot run program "C:/Program Files (x86)/Java/jdk1.8.0_45/bin/java"


I am trying to run a java-based Play 2.0 app in IDEA, but upon compilation, I get this error:

Information:Internal caches are corrupted or have outdated format, forcing project rebuild: Module 'web-server' production: java.io.IOException: Cannot run program "C:/Program Files (x86)/Java/jdk1.8.0_45/bin/java" (in directory "C:\Users\\Documents\GitHub\\web-server"): CreateProcess error=267, The directory name is invalid

This occurs during a ProcessBuilder.start() action.

I have made sure all the path variables are properly set, even changing them up to ensure that they work properly. The thing that gets me here is that it seems like ProcessBuilder is trying to use forward slash paths, but I'm running in Windows.

I've tried reloading my project from scratch, invalidating the cache and restarting, updating my java installation (both 32- and 64-bit), and uninstalling and reinstallating IDEA, but it just won't seem to work. This same project runs fine on another computer, so I'm thinking it might be a local issue. Any help would be greatly appreciated!


Solution

  • I had the same issue, here is how I solved it:

    Clearly there is something wrong with the directory path. Mine was "D:\IntelliJ Workspace\" but in error message it was "D:\IntelliJ+Workspace\". When I remove the space in directory name the error was fixed.

    In your situation "C:\Users\\Documents\GitHub\\web-server" has extra back slashes so when you fix this, I think your error will be fixed.