In scripts\StartIBC.bat, there's the line
for /f "tokens=1,2 delims== usebackq" %%A in (`java.exe -XshowSettings:properties 2^>^&1 ^| findstr /C:"java.version ="`) do set java_version=%%B
the java.exe in the for statement should be changed to .\java.exe because just java.exe can cause the warning:
'java.exe' is not recognized as an internal or external command,
operable program or batch file.
this causes the variable java_version to never be set, and the later line
if not "%java_version:1.8=%"=="%java_version%" set moduleAccess=
then crashes the script with the error set was unexpected at this time, neatly escalating a warning into a crash, and
needless to say, the IB TWS or Gateway, which are called later, never run.
This 'java.exe' is not recognized issue can happen if the cmd or Powershell environment that runs StartIBC.bat is not set up correctly.
Using just java.exe can work if your terminal's PATH includes . or has other settings that allow current-directory search,
or your terminal has system-wide PATH that includes common directories. If this is not the case, then it may not work, which has definitely happened on my Windows 10 box and the fix below worked.
The fix is to change the java.exe in
:: temporarily change the current working directory because using "%JAVA_PATH%\java.exe" in the following 'for' statement causes an error
pushd "%JAVA_PATH%"
for /f "tokens=1,2 delims== usebackq" %%A in (`java.exe -XshowSettings:properties 2^>^&1 ^| findstr /C:"java.version ="`) do set java_version=%%B
:: restore the original current working directory
popd
to .\java.exe as follows
:: temporarily change the current working directory because using "%JAVA_PATH%\java.exe" in the following 'for' statement causes an error
pushd "%JAVA_PATH%"
for /f "tokens=1,2 delims== usebackq" %%A in (`.\java.exe -XshowSettings:properties 2^>^&1 ^| findstr /C:"java.version ="`) do set java_version=%%B
:: restore the original current working directory
popd
In
scripts\StartIBC.bat, there's the linethe
java.exein theforstatement should be changed to.\java.exebecause justjava.execan cause the warning:this causes the variable
java_versionto never be set, and the later linethen crashes the script with the error
set was unexpected at this time, neatly escalating a warning into a crash, andneedless to say, the IB TWS or Gateway, which are called later, never run.
This
'java.exe' is not recognizedissue can happen if the cmd or Powershell environment that runsStartIBC.batis not set up correctly.Using just
java.execan work if your terminal's PATH includes . or has other settings that allow current-directory search,or your terminal has system-wide PATH that includes common directories. If this is not the case, then it may not work, which has definitely happened on my Windows 10 box and the fix below worked.
The fix is to change the
java.exeinto
.\java.exeas follows