I am trying to run a java-based Play 2.0 app in IDEA, but upon compilation, I get this error:
我试图在IDEA中运行一个基于java的Play 2.0应用程序,但在编译时,我得到了这个错误:
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
信息:内部缓存已被破坏或已经过时,迫使项目重建:模块“web服务器”的生产:java.io。IOException:不能运行程序“C:/程序文件(x86)/Java/jdk1.8.0_45/bin/ Java”(在目录“C:\ \\ \\ \\ \\ \\web服务器”):CreateProcess error=267,目录名无效。
This occurs during a ProcessBuilder.start()
action.
这发生在ProcessBuilder.start()操作中。
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.
我已经确保所有的路径变量都正确设置,甚至更改它们以确保它们正常工作。这里让我想到的是,ProcessBuilder似乎在尝试使用正斜杠路径,但我在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!
我尝试从头开始重新加载我的项目,使缓存失效,重新启动,更新我的java安装(32位和64位),以及卸载和重新安装的想法,但这似乎并不起作用。这个项目在另一台电脑上运行良好,所以我认为这可能是一个本地问题。非常感谢您的帮助!
4 个解决方案
#1
1
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.
显然,目录路径有问题。我的是“D:\IntelliJ Workspace\”,但在错误信息中是“D:\IntelliJ+Workspace\”。当我删除目录名中的空格时,错误是固定的。
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.
在你的情况下,“C:\ \\ \\ \\ \\ \\网络服务器”有额外的反斜杠,所以当你解决这个问题时,我认为你的错误将会被修正。
#2
2
I had this problem recently, i solved in 2 steps.
我最近遇到了这个问题,我用2个步骤解决了这个问题。
Part 1
第1部分
If your path JAVA_HOME is OK:
如果你的路径JAVA_HOME是好的:
File → Settings → Build, Execution, Deployment → Build Tools → Maven → Runner
文件→设置→构建、执行部署→构建工具→Maven→跑步者
Set to "use JAVA_HOME (...Path...)"
设置为“使用JAVA_HOME(…路径…)”
If you set with a fixed string, the problem may reappear when in future you will re-update. Anyway, you can do that.
如果您设置了一个固定的字符串,问题可能会在将来重新出现,您将重新更新。不管怎样,你可以这么做。
Part 2
第2部分
File → Other Settings → Default Project Structure
其他设置的默认项目结构。
Check all the tabs and ensure that all the path point to the newly installed JDK (If you change in one, then you should have all changed, e.g. i changed in Annotations)
检查所有的选项卡,确保所有的路径指向新安装的JDK(如果您更改了一个,那么您应该已经全部更改了,例如,我在注释中更改了)
If you cannot select the path (error: not valid path), try not to use the one in C:\Program Files (x86)\Java...\ -- select the one in C:\Program Files\Java...\ (or viceversa)
如果你不能选择路径(错误:无效的路径),尽量不要使用C:\Program Files (x86)\Java...中的一个在C:\Program Files\Java... \——选择一个\(或反之亦然)
#3
0
I had same issue with idea 14.1.4. Changing Maven Runner option to Use JAVA_HOME helped. Settings > Maven > Runner Set JRE to Use JAVA_HOME.
我对14.1.4有同样的看法。更改Maven Runner选项以使用JAVA_HOME帮助。设置> Maven > Runner Set JRE使用JAVA_HOME。
#4
0
Had the same issue as the folder containing the project has spaces in its name. Worked perfectly after removing the spaces and renaming it.
与包含项目的文件夹相同的问题有其名称空间。删除空格并重新命名后,工作非常完美。
#1
1
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.
显然,目录路径有问题。我的是“D:\IntelliJ Workspace\”,但在错误信息中是“D:\IntelliJ+Workspace\”。当我删除目录名中的空格时,错误是固定的。
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.
在你的情况下,“C:\ \\ \\ \\ \\ \\网络服务器”有额外的反斜杠,所以当你解决这个问题时,我认为你的错误将会被修正。
#2
2
I had this problem recently, i solved in 2 steps.
我最近遇到了这个问题,我用2个步骤解决了这个问题。
Part 1
第1部分
If your path JAVA_HOME is OK:
如果你的路径JAVA_HOME是好的:
File → Settings → Build, Execution, Deployment → Build Tools → Maven → Runner
文件→设置→构建、执行部署→构建工具→Maven→跑步者
Set to "use JAVA_HOME (...Path...)"
设置为“使用JAVA_HOME(…路径…)”
If you set with a fixed string, the problem may reappear when in future you will re-update. Anyway, you can do that.
如果您设置了一个固定的字符串,问题可能会在将来重新出现,您将重新更新。不管怎样,你可以这么做。
Part 2
第2部分
File → Other Settings → Default Project Structure
其他设置的默认项目结构。
Check all the tabs and ensure that all the path point to the newly installed JDK (If you change in one, then you should have all changed, e.g. i changed in Annotations)
检查所有的选项卡,确保所有的路径指向新安装的JDK(如果您更改了一个,那么您应该已经全部更改了,例如,我在注释中更改了)
If you cannot select the path (error: not valid path), try not to use the one in C:\Program Files (x86)\Java...\ -- select the one in C:\Program Files\Java...\ (or viceversa)
如果你不能选择路径(错误:无效的路径),尽量不要使用C:\Program Files (x86)\Java...中的一个在C:\Program Files\Java... \——选择一个\(或反之亦然)
#3
0
I had same issue with idea 14.1.4. Changing Maven Runner option to Use JAVA_HOME helped. Settings > Maven > Runner Set JRE to Use JAVA_HOME.
我对14.1.4有同样的看法。更改Maven Runner选项以使用JAVA_HOME帮助。设置> Maven > Runner Set JRE使用JAVA_HOME。
#4
0
Had the same issue as the folder containing the project has spaces in its name. Worked perfectly after removing the spaces and renaming it.
与包含项目的文件夹相同的问题有其名称空间。删除空格并重新命名后,工作非常完美。