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]
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 c5e31645a362bb552c826fc81d3b1a32f70b2b39, 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.
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?
Thanks, Josh.
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!
A quick fix for me was to add javac to my PATH.
Most helpful comment
A quick fix for me was to add javac to my PATH.