Skip to content

Instantly share code, notes, and snippets.

@yipo
Last active December 13, 2015 22:19
Show Gist options
  • Save yipo/4983625 to your computer and use it in GitHub Desktop.
Save yipo/4983625 to your computer and use it in GitHub Desktop.
Why `javac' can't work in the Makefile? Solution: you don't have to double-quote paths in the variable PATH, even they have spaces.
@ECHO OFF
CD /D %~dp0
ECHO [Before]
javac -version
PATH %PATH%;C:\MinGW\bin;C:\Program Files (x86)\Java\jdk1.7.0_13\bin
ECHO [After]
javac -version
mingw32-make
PAUSE
all:
@echo [Makefile]
@echo %PATH%
@echo ---
javac -version
[Before]
'javac' is not recognized as an internal or external command,
operable program or batch file.
[After]
javac 1.7.0_13
[Makefile]
C:\Program Files (x86)\MacType\;C:\Windows\system32;C:\Windows;C:\Windows\System
32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\MacTy
pe;C:\MinGW\bin;"C:\Program Files (x86)\Java\jdk1.7.0_13\bin"
---
javac -version
process_begin: CreateProcess(NULL, javac -version, ...) failed.
make (e=2): twC
mingw32-make: *** [all] Error 2
Press any key to continue . . .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment