Running Clarion program exe from JAVA


#1

I am new to Clarion so her goes…
I need to start and run a Clarion exe from a JAVA application. I’ve tried using JAVA ProcessBuilder and can locate the exe but I need to pass three parameters to the program and that’s where I’m having trouble.
Anyone had any luck with this?


#2

You can use COMMAND in Clarion to get passed parameters


#3

Thanks for the hint. However I’m stuck at an earlier step.
Let me rephrase the issue.
I need to get the passed parameters TO the Clarion app so that it can read them.
This is the Java code I’m attempting to use:


String cmd = {"//directory/exe/clarionApp.exe",“99996”, “AUTO”, “abc”};
Runtime.getRuntime().exec(cmd);


The code is touching the program, it is erroring out with a message because it’s not getting the three parameters. I’ve tried creating a connection string with the program name along with the concatenated parameters for example (//directory/exe/clarionApp.exe&99996&AUTO&abc) and other combinations, but I then get a “Can’t find file” error.

Any suggestions on what the connection string should look like to allow clarion to parse the parameters?
Thanks


#4

No idea if this works.


#5

Don’t you need to put spaces between exe name and parameters?
How is command processed on Clarion side?


#6

Thanks, Rick. That’s actually where I got the idea that I could do this.
And alas, it doesn’t appear to work-at least for me. I’m also not real clear on how Clarion interprets the string.


#7

That is one of the issues. I’m only marginally familiar with Clarion. There are a couple of Clarion programs that call this particular program and it appears to use a connection string with the parameters separated by the ampersand.


#8

if it expects one string as a command with parameters separated by ampersand I would try
String cmd = {"//directory/exe/clarionApp.exe",“99996&AUTO&abc”};