How to start a Java Console App out of Servoy?

As the Subject tells:
I am trying to run a Java Console Application out of servoy.
I found the method :
application.executeProgram( )

Whe I try this:
application.executeProgram( ‘c:/report/BewerberhandoutApp.jar’, ‘#’, ‘path=c:/report’, ‘#’, ‘c:/report’)
I get the exception:

java.io.IOException: CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung (This is not a valid Win32-Application)
Which, in my mind, Is correct.
But if I try this:
application.executeProgram( ‘java - jar c:/report/BewerberhandoutApp.jar’, ‘#’, ‘path=c:/report’, ‘#’, ‘c:/report’)
I get the Exception:
java.io.IOException: CreateProcess error=2, Das System kann die angegebene Datei nicht finden (The System is unable to find the specified file)

So i tried to execute a batch file:
application.executeProgram( ‘c:/report/startBwh.bat’, ‘#’, ‘path=c:/report’, ‘#’, ‘c:/report’)
but now Nothing happens…
No Console popping up, or anything else.
Anybody an idea to solve this?

Thanks in advance!

Jan

P.S. executeProgrammInBackground doesnt work either…

GevatterTod:
application.executeProgram( ‘c:/report/startBwh.bat’, ‘#’, ‘path=c:/report’, ‘#’, ‘c:/report’)

I don’t think this will work because the application arguments should be available to the java app (unless you read them in with the bat file).

GevatterTod:
application.executeProgram( ‘java - jar c:/report/BewerberhandoutApp.jar’, ‘#’, ‘path=c:/report’, ‘#’, ‘c:/report’)

I have not tried it but what happens when you split the first argument ‘java - jar c:/report/BewerberhandoutApp.jar’ into three ‘java’, ‘-jar’ , ‘c:/report/BewerberhandoutApp.jar’ but before you do that, while copying your line I noticed there is a space between ‘-’ and ‘jar’ that should not be there…

IT2Be:
I don’t think this will work because the application arguments should be available to the java app (unless you read them in with the bat file).

Quite in fact the Programm doesn’t need any Arguments, because it gets the needed value by a User input in the console during runtime of the App.

IT2Be:
I have not tried it but what happens when you split the first argument ‘java - jar c:/report/BewerberhandoutApp.jar’ into three ‘java’, ‘-jar’ , ‘c:/report/BewerberhandoutApp.jar’ but before you do that, while copying your line I noticed there is a space between ‘-’ and ‘jar’ that should not be there…

The Space is a mistyping I only had in this post.
When I tried out there has been no Space in the line.

I tried to split the Arguments like this:

function meth_report_allCompanys_projekt()
{
	var myPath = 'C:\\report\\BewerberhandoutApp.jar';
	var myPath2 = 'C:\\report\\startBwh.bat';
  	var jsFile = plugins.file.convertToJSFile(myPath);
	var jsFile2 = plugins.file.convertToJSFile(myPath2);
	var java = "java ";
	var jar = "-jar ";
		
  	if (!jsFile.exists() || !jsFile2.exists()) {

  	plugins.dialogs.showErrorDialog( "Fehler",  "Die benötigten Dateien befindet sich nicht auf ihren Rechner! Bitte wenden sie sich an ihren Administrator",  "OK")

  	}
  	else
  	{	
  		application.executeProgram( java + jar + myPath, '#', 'path=c:/report', '#', 'c:/report')
  	}

	
}

Console output:

Fehler beim Starten des Programms:java -jar C:\report\BewerberhandoutApp.jar
 > java.io.IOException: CreateProcess error=2, Das System kann die angegebene Datei nicht finden

The HardCoded Versions:

application.executeProgram( "java -jar \"C:\\report\\BewerberhandoutApp.jar\"", '#', 'path=c:/report', '#', 'c:/report')
application.executeProgram( "java -jar C:\\report\\BewerberhandoutApp.jar", '#', 'path=c:/report', '#', 'c:/report')

dont work as well.
Even though the both lines Above work when executed in a windows command line.

And this:```
application.executeProgram( ‘java’, ‘-jar’, ‘C:\report\BewerberhandoutApp.jar’, ‘#’, ‘path=c:/report’, ‘#’, ‘c:/report’)

btw I am not even sure you can call a java command from java…

Well. It looks like something happens, but the client freezes if i execute the method… :(

Looks like I have to find another way round.

Despite:
Thank you very much for spending your time on my problem ;)

BewerberhandoutApp.jar

What is this doing?
Is it something you made yourself?
Maybe it is easy to change it into a Plug-in?
When it can be changed I might be able to help you. In that case please send an email to contact at it2be dot com

Done ;)

Thanks a lot.