OH3: Http port different when run as service vs via console / cmd

  • Platform information:
    • Hardware: PC
    • OS: Windows 10
    • Java Runtime Environment: Adopt One JDK
    • openHAB version: 3.0.1

I am having bit of an issue, with trying to modify the http port in windows 10.

-I nstalled OH3 in windows 10 (basically set java home download and extract)

  • Run OH3 and confirm it was working fine
  • Updated the \runtime\bin\setenv.bat HTTP_PORT=8099
  • Confirm the web ui was available in 8099 port. All working good.

Then i decided to make OH3 as a service and did the steps in documentation to make OH3 service again all good.

  • But if i start OH3 as service the web ui port is 8080 not 8099 as set in the setenv.bat (and in setenv) file.
  • But if i stop the service and start OH3 via command prompt the http port configured in setenv is being used as 8099.

Now i am scratching my head how do i make sure my OH3 as service uses the port 8099 and not default to 8080
Can some one please help.

P.S i have i don’t have any \etc\default\ folder as mentioned in other help topics.

I don’t use Windows but I don’t think the way you run OH as a service uses start.bat. So you’ll need to set that environment variable in the service file. Beyond that I can’t help. I don’t even have a Windows machine any more to test stuff on.

thanks, found the solution here