Fresh install of OH3.1 - may be a 'can't run .bat files' problem or a Java install problem

Hi All
I’ve had an OH 2.5 (and older) install running for years. I want to test OH3 on a different Win 10 laptop before I migrate.

I made an initial mistake of installing JRE version 8 301 but the OH3 install went fairly OK until I tried to run start.bat. That threw lots of errors.

In trying to edit start.bat to see what it did I may have associated it by accident with notepad++

Now if I double-click on any .bat file I get a “Windows can’t find the file” error:

I can still run it by launching from command prompt though.

This gave other similar errors. After a while, I read TFM properly and removed java and reinstalled Zulu java and updated the Env Variable JAVA_HOME to C:\Program Files\Zulu\zulu-11.

Still no luck, so I followed Karaf.bat, and this is throwing the following error:

C:\OpenHAB\runtime\bin>rem Retrieve java version

C:\OpenHAB\runtime\bin>for /F tokens=2-5 delims=.-_+" %j in (’“C:\Program Files\Zulu\zulu-11\bin\java” -fullversion 2>&1’) do (if %j == 1 (set JAVA_VERSION=%k ) else (set JAVA_VERSION=%j ) )
‘“C:\Program Files\Zulu\zulu-11\bin\java” -fullversion 2>&1’ is not recognized as an internal or external command,
operable program or batch file.
8 was unexpected at this time.
C:\OpenHAB\runtime\bin>if GTR 8 (

Now I don’t know whether this is a problem launching .bat files or a problem with Java or JAVA_HOME.

Any ideas?


  • to check if the association is correct or not open a cmd box and enter:
    assoc .bat
  • the error message from karaf.bat looks strange. A first check to test if JAVA_HOME is ok copy paste C:\Program Files\Zulu\zulu-11\bin\java” -fullversion into command box. It should return version information about the installed java version. In case the environment variable contains wrong path it should not return the version information.
1 Like

Hi Wolfgang

Thanks for your help.

I tried both and both look fine. Batfile and successful Java version. I think Java is fine, so it looks like a .bat problem or similar.

After further digging on the internet around .bat file problems I noticed that my ComSpec Environment Variable had somehow been changed to the old Java install folder. It should be the Windows system folder. Weird. Well, I changed it, rebooted and now all is well :slight_smile:

I honestly don’t know if this was my fat fingers (most likely) or what but I’m back in business and that’s the main thing.

Thanks for your help. It pointed me in the right direction.


1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.