Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.io.IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified if the path to javac contains space #510

Closed
OlegYch opened this issue Jul 27, 2012 · 5 comments

Comments

@OlegYch
Copy link
Contributor

OlegYch commented Jul 27, 2012

SBT 0.11.3 windows

set PATH=d:\Distrib\Coding\Java\scala\sbt;d:\cygwin\bin;d:\cygwin\bin;c:\windows\system32; D:\Distrib\Coding\Java\jdk\jdk1.7.0_05\x86\bin
which javac
javac is an external : D:\Distrib\Coding\Java\jdk\jdk1.7.0_05\x86\bin\javac.EXE
xsbt clean compile
...
java.io.IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
...
set PATH=d:\Distrib\Coding\Java\scala\sbt;d:\cygwin\bin;d:\cygwin\bin;c:\windows\system32;D:\Distrib\Coding\Java\jdk\jdk1.7.0_05\x86\bin
xsbt clean compile
...
[success]

@harrah
Copy link
Member

harrah commented Aug 7, 2012

I think this is a bug at a lower level, perhaps java.lang.ProcessBuilder. sbt doesn't parse the PATH variable. It runs the javac program without a prefix via ProcessBuilder. I don't remember the exact reason for the special casing of forking git in c5e3164, but perhaps @jsuereth can comment on whether this is the same problem.

If you specify javaHome explicitly (such as in your ~/.sbt/global.sbt configuration file), it will construct the path to the binary directly. I expect that would be a suitable workaround.

@jsuereth
Copy link
Member

jsuereth commented Aug 8, 2012

The git stuff uses cmd /c because git has a .cmd file in the path you use. THIS is that we can't find javac on the path.

Can you add two things for helping debug?

(1) Is it a 64-bit JDK
(2) Are you using one of our MSI installs, or your own start script?

@harrah
Copy link
Member

harrah commented Aug 8, 2012

Thanks, Josh.

@OlegYch
Copy link
Contributor Author

OlegYch commented Aug 8, 2012

Hi, everybody.
I've found the cause. I'm using tcc/le and it was applying some special logic to fix such a broken PATH, so i was able to use javac from command line. This of course did not affect ProcessBuilder API.
Thanks for your attetntion!

@OlegYch OlegYch closed this as completed Aug 8, 2012
@mkonicek
Copy link

A quick fix for me was to add javac to my PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants