Creating a OSX startup program in Terminal to run openHAB

I am running OS 10.14 on a Mac Mini, and I setup openHAB on the Mac and its running fine and now I’m able to control my Insteon devices from my iPhones and iPads. I have the Mac running all the time, so that’s why I installed it there. I’m not very knowledgeable with Terminal, but what I want to do is have openHAB run the ./ file whenever the Mac is rebooted, just so I don’t have to remember to manually start it up. I assume that file has to be running in order for me to be able to see and control the Insteon devices. Can someone help me with this. I tried Automator, but it just ran a text file, I couldn’t figure out how to get it to run it in Terminal. Thanks.

Is the file in openHAB an OSX shell script or something else? If I just click on it, it opens and shows the text. It doesn’t run the openHAB program. To run openHAB I have to open Terminal in OSX, and then change the directory to the openHAB directory, and then enter the file name command, ./ , and then hit enter in order for it to load and run openHAB. Am I doing something wrong?

Ok, well I finally figured it out. I went to the file, right clicked it, selected Get Info, and changed Open With from TextEdit to Terminal. That made the file open and run in Terminal when its clicked/opened. Then to get it to run automatically when I restart the Mac Mini, I went into Users, selected my name, then Login Items, and then added the file. Now whenever the Mac is restarted, it will automatically run the openHAB app, and my system will be seen on my iPhones and iPads, etc. Hope this is usefull to others. A simple solution, but hard for me to figure it out.