I need to launch an external app called TeamViewer from my JavaFX application. So I've TeamViewer.app file which I'm copying to a temporary folder and launching it using:
Runtime.getRuntime().exec("open /path/to/Teamviewer.app");
But this is throwing Directory not empty IOException.
I also tried launching using shell file where I wrote "open /path/to/Teamviewer.app" command to launch.sh and launched launch.sh using process created by ProcessBuilder.
if I run launch.sh from terminal, it works. But from java program,
following exception is thrown:
SEVERE: null
java.io.IOException: Cannot run program "sh" (in directory "/Applications/ColorDx.app/Contents/Java"): error=66, Directory not empty
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at com.sc.colordx.controller.ColorDxSupportController.executeCommand(ColorDxSupportController.java:288)
at com.sc.colordx.controller.ColorDxSupportController.launchSetup(ColorDxSupportController.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
What could be the reason for directory not empty exception? It has to be non empty as I've copied TeamViewer.app there.
Could this be a multi threading issue? Means I'm copying TeamViewer.app first and immediately launching it. Is there a chance that launch command is called before copying is finished?
TIA