Exec binding

Hello!

I made some java apps, and I would like to use them with the exec binding.

I am new to Java, and I would not say that I am professional with the openhab, but I made some good stuff I hope.

My question is that in my rules file first I call a Java app, which lists the com ports and writes them to a file, then I call a C program which reads the file and writes the sitemap file with it.
The easiest way should be to simply use a Java app, and it lists the ports and writes them to the sitemap file, but openHAB does not let me do that, as a result I made a C app.
In the rules file: executeCommandLine(“java iii”)
executeCommandLine(“c:/port.exe”)
(name of the java program is iii, and the C is port)

However the java program does not do anything, there is not any error message simply the program does not write to the given txt file. I would appreciate some help, thanks

??? How does OH not let you do that? If you are executing an external Java app as you describe, there should be no difference between the Java or the C++.

To see the output from calling your program you need to add a timeout and catch the results:

val results = executeCommandLine("java iii", 5000)

If I had to guess the problem, I would guess that either java.exe is not in your path or iii is not in the base path openHAB is executing from (presumably the openHAB base directory.

Try using the full path names.

NOTE: even if the above worked, you would probably still have problems because when you don’t provide a timeout on executeCommandLine, it immediately returns without waiting for the command to finish, letting it execute in the background. Consequently port.exe would very likely be started before iii has finished.

Because when I want to write the sitemap file with a java application it sends an error message that another application is using the sitemap file.
I would appreciate some help about it, and if we are talking about this problem, I am using wireless microcontrollers with a webcam, and I would like to display it with an image element, when I am trying to overwrite the image it sends an error message that the image is used by another application, is there any solution to overwrite the image,?

Yes the problem was that, thank you

Thanks for your help

This is odd behavior because Designer, a Java application, has no problem writing to the sitemap while OH is running. I’m not sure what is going on here.

I’m wondering if the errors have more to do with a permissions problem than a lock. But I’ve never seen this behavior.