Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Execute jar from Delphi
I need to execute the followin from Delph
java -jar "C:\dev\Java\MotolubeExpor
8/22/2022 - Mon
var si: TStartupInfo;
FillChar(pi, SizeOf(pi), 0);
FillChar(si, SizeOf(si), 0);
si.cb := SizeOf(si);
si.dwFlags := STARTF_USESHOWWINDOW;
si.wShowWindow := SW_SHOWNORMAL;
CreateProcess(nil, 'java -jar "C:\dev\Java\MotolubeExpor
t.jar', nil, nil, False, CREATE_NEW_CONSOLE, nil, nil, si, pi);
Maybe I should add, that a .bat File exists, which executes normally. My problem however is, that "Createprocess" returns immediately, without waiting for the "Actual Process" to finish, which I need to do, as there are additional tasks to be performed after execution.
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
if you start .bat file that in turn starts java CreateProcess will always return immedietly, if you want to wait for actual process you must strat process directly not via .bat. also note that if you use CreateProcess() with WaitForSingle Object() you'll enter wait state until process terminates not until it's started
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
Just tried it, but didn't work. Executing the Batch File however, always works.
do you have java.exe \Windows\system32 directory or in any other directory thats included in PATH?
try also using full path to exe something like this:
exe -jar C:\dev\Java\MotolubeExport
.jar', nil, nil, False, CREATE_NEW_CONSOLE, nil, nil, si, pi);
btw. >>"<< character shouldn't be before C:\..., my mistake
I don't have java on my System. This is for one of my Clients, who does, and thiat's the content of the Batchfile he is normally executing via an Icon from his Desktop.
to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
if you don't have java how you want to test your app?
I am EMailing the App, which is very small, to my Client, who runs it, and reports back. This is just a One-Liner and it's no hassle.
yeah but debugging is a hassle and since you have problem I think debugging would be helpfull
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
In my stupidity I forgot a Double Quote in the Commandline. However, I am awardiing you the points for your efforts anyway.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent