Qlik Community

QlikView Publisher

Discussion Board for collaboration on QlikView Publisher.

mphowlett
New Contributor II

Execute external program - Java command line not working in publisher

Hi,

I have a QlikView document which executes an external program (Java), then reads in the output file that it created, does some transformation and stores the results to a QVD. This works fine in development and I can log onto the server as the service account and it works runs fine when I run it as the service account on the server. However, when I try and run it through the QEMC as a task it does not work correctly. It does not fail but clearly does not execute the Java command line because the timestamp on the output file from the Java call does not change, but the stored QVD timestamp does, it is like it just ignores this step completely

I have managed to schedule a number of other QlikView documents which execute standard external command line executableslike "copy" without any issues. I have the "Can Execute External Programs" box checked in the application and I believe the publisher is setup correctly.

I've also tried setting up bat files and executing the bat file in QlikView instead of Java directly and it doesn't work or make any difference.

Anybody been able to setup/schedule a QlikView document to call Java or some other custom executable from Publisher?

Thanks,

Matt

Tags (3)
1 Solution

Accepted Solutions
Not applicable

Re: Execute external program - Java command line not working in publisher

You have to specify the path of the java bin folder in your batch file, otherwise the "java" command won't be found when executed in the QMC.

For instance, if you need to execute "example.jar" located in "C:\ExamplePath", you have to create a "example.bat" file in the same path with the following content:

SET filepath=C:\ExamplePath

SET java_path=C:\Program Files\Java\jre7\bin :: <your java bin folder>

C:

CD %filepath%

"%java_path%\java.exe" -jar "example.jar"

Then in your QV script:

EXECUTE cmd.exe /C "C:\ExamplePath\example.bat";

3 Replies
Not applicable

Re: Execute external program - Java command line not working in publisher

Hi Matthew,

Not all macros can be excuted when run thru QlikView Server.

Do you try to execute the command direct in QMC´s command line or do you call a batch file that is running the operation?

Not applicable

Re: Execute external program - Java command line not working in publisher

You have to specify the path of the java bin folder in your batch file, otherwise the "java" command won't be found when executed in the QMC.

For instance, if you need to execute "example.jar" located in "C:\ExamplePath", you have to create a "example.bat" file in the same path with the following content:

SET filepath=C:\ExamplePath

SET java_path=C:\Program Files\Java\jre7\bin :: <your java bin folder>

C:

CD %filepath%

"%java_path%\java.exe" -jar "example.jar"

Then in your QV script:

EXECUTE cmd.exe /C "C:\ExamplePath\example.bat";

mphowlett
New Contributor II

Re: Execute external program - Java command line not working in publisher

Thank you, that seems to have done the trick - I still find this a bit strange because I set the whole Java environment up using the QMC service account and System Variables (JAVA_HOME, CLASSPATH etc..).

Anyway, putting the same variables and values in the batch file as suggested did the trick, so many thanks!

Community Browser