Solved. I have made a modification to cocos-js, namely:
cocos2d-js-v3.1\tools\cocos2d-console\plugins\project_compile\build_web\__init__.py
The line
child = subprocess.Popen(commands, stderr=subprocess.PIPE)
changed to
child = subprocess.Popen(commands, stderr=subprocess.PIPE, shell=True)
As it was mentioned here: http://www.bogotobogo.com/python/python_subprocess_module.php
The reason is following: it seams that with shell command the process is run on top of intermediate shell which inherit all envrionment variables, while without it uses unknown own (or run without?). And without environment it checkes default paths (i.e., “system32”), where dummy “java.exe” exists.
Verified with “ant”, which is inside my OS “system variables”:
C:\Users\laser>python
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call("ant")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python27\lib\subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Program Files\Python27\lib\subprocess.py", line 710, in __init__
errread, errwrite)
File "C:\Program Files\Python27\lib\subprocess.py", line 958, in _execute_chil
d
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
>>> subprocess.call("ant", shell=True)
Buildfile: build.xml does not exist!
Build failed
1
PS: also it is recomended to run “call” instead of “Popen” on subprocess… however in sourcecode the “call” is “popen(…).wait()”