Cannot call external program (.bat or .exe) from within Oxygen on Windows 8

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
kai_weber
Posts: 2
Joined: Tue May 05, 2020 9:57 am

Cannot call external program (.bat or .exe) from within Oxygen on Windows 8

Post by kai_weber » Tue May 05, 2020 10:40 am

I have prepared an Oxygen project setup for a team of around 10 people. My setup contains an external tool integration that calls a windows executable file (I tried for both .exe and .bat files). The project setup works for all users except one. The main difference that I can see is that this one user is still working on a Windows 8 platform, while all (?) others are running Windows 10. We're all running Oxygen 21.1 at the moment.

I am aware that this is difficult to debug with just a description of the problem and without access to the actual machine, but maybe somebody can give me hints on what I could do to further debug and pinpoint the actual problem? So here are the details:

My external tool setup is:

Working folder: ${pd}/tools

Code: Select all

curl.exe -i -F "${cfne}=@${cf}" -F "user=${env(username)}" https://.... some URL .../api
The error message displayed in the execution window of the affected user is:
Could not start: Cannot run program "curl.exe" (in directory "C:\Users\Manuela\Documents\Git\dh-unitue-rke-proj\tools"): CreateProcess error=2, Das System kann die angegebene Datei nicht finden
java.io.IOException: Cannot run program "curl.exe" (in directory "C:\Users\Manuela\Documents\Git\dh-unitue-rke-proj\tools"): CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at ro.sync.cmdline.h.b(Unknown Source)
at ro.sync.cmdline.e$1.dxd(Unknown Source)
at ro.sync.ui.application.mb.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 5 more
Process ended with exit code: -1234567
So it is basically a file not found exception, while I can say that the file is definitely stored under the given path. I have also asserted that the user has execution rights for the program. Furthermore I tried to wrap my call of curl.exe in a Windows-Batch file (.bat), with the same result: It tells me that filename.bat cannot be found under the given path.

When I execute a right-click on the Batch file in the project window and select "open with system application" I have the same results: It works on my computer (Win 10) and fails on the affected user's (Win 8 ). And a third test I ran was: I added a transformation scenario, which generates a batch file on the fly. The transformation scenario stores the generated batch file unter `${pd}/tools/preview.bat` and I set the option "Open the generated file in browser/system application" after the transform has run. Again: When executing the transformation scenario on my Win 10, this will automatically execute the generated batch file, but comes up with a file not found error on the other user's Win 8.

I don't think that this is a problem with any PATH environment variable issues, as the path is actually not needed. I am only dealing with absolute paths to the executables that I want to run, the executables are always inside the project folder. So what could cause this, any ideas?

adrian
Posts: 2648
Joined: Tue May 17, 2005 4:01 pm

Re: Cannot call external program (.bat or .exe) from within Oxygen on Windows 8

Post by adrian » Tue May 05, 2020 11:45 am

Hi,

From what I tested it doesn't work as intuitively expected: folder path in Working directory and exe name in command line.
Try using the full path for the executable in the Command line field. Use double quotes around the path. Like so:

Code: Select all

"${pd}/tools/curl.exe" ...
It's not a problem with the PATH environment variable, but it probably works for you because your PATH may contain a folder where curl.exe is located. For those that don't have it, it will fail.
Try on your machine in a Command Prompt window:

Code: Select all

where curl.exe
If it's in the PATH, you'll get the location as a result.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

kai_weber
Posts: 2
Joined: Tue May 05, 2020 9:57 am

Re: Cannot call external program (.bat or .exe) from within Oxygen on Windows 8

Post by kai_weber » Thu May 07, 2020 12:07 pm

Dear Adrian,

thanks a lot, that worked!

(At least for the external tool definition. I didn't ask our customer to check if the starting of a generated batch file at the end a transformation scenario run would work. I assume it doesn't, because we have changed nothing there. However, our problem is solved, the transformation scenario was only an attempted workaround.)
image.png
image.png (28.94 KiB) Viewed 83 times

Post Reply