This is not all that difficult if the class you are calling is set up to handle all of the parameter the Java code will require. The base of the following code is the call to the RUN command.
// OKnight, 29-JAN-2007.
ib_first_pass = TRUE
ls_java_exe = "c:\windows\system32\java.exe" // We have code to ensure this is correct
is_java_title = ls_java_exe
logWrite (il_aurlog, " Source UID = " + string (ii_source_uid))
logWrite (il_aurlog, " File name = " + is_pathname + is_filename)
// OKnight, 15-FEB-2005. Wrap all string parms in double-quotes.
// The variables used in the string below were all determined previously.
// The class is StartCabsProcessing and everything after that are the class parameters.
// ----------------------------------------------------------------------------------------------------------
ls_cmd = ls_java_exe + &
' -Xmx' + String(ii_memory) + 'm' + &
' -cp "' + ls_jar_file + '"' + &
' StartCabsProcessing -UID=' + String(ii_aur_source_uid) + &
' -FILEUID=' + String(ii_source_uid) + &
' -SS=' + String(il_batch_size) + &
' -CONFIGFILE="' + ls_config_file + '"' + &
' "' + is_pathname + is_filename + '"'
// Actually start the JAVA process....
li_ret = run (ls_cmd, Minimized!)
IF li_ret <= 0 THEN
ls_txt = "The RUN command failed to start JAVA.EXE. ~r~n " + &
"~r~n Java: " + ls_java_exe + &
"~r~n CFG: " + ls_config_file + &
"~r~n Jar: " + ls_jar_file + &
"~r~n Path: " + is_pathname + &
"~r~n File: " + is_filename + &
"~r~n Memory: " + String(ii_memory) + &
"~r~n UID: " + String(ii_aur_source_uid) + &
"~r~n Source ID: " + String(ii_source_uid) + &
"~r~n Batch Size: " + String(il_batch_size) + &
"~r~n~r~n ls_cmd: " + ls_cmd
GOTO Exit_Function
END IF
// Prevent the user from closing the window before we are done
of_set_prevent_close (TRUE)
// OKnight, 10-NOV-2014, R#550105: Enable the CANCEL button.
cb_cancel_processing.Enabled = TRUE
cb_folder_start.Enabled = FALSE
wf_set_progress (0.20) // Progress meter displayed to the user
ib_javaprocstarted = TRUE
ls_pathname = is_pathname + is_filename + ".out" // OKnight, 24-OCT-2006.
// OKnight, 24-OCT-2006. Its possible that the Java processing will complete
// before we get here, so check for that condition.
time lt_start, lt_curr
long ll_seconds
Sleep (2)
lt_start = Now ()
DO
val = FindWindowW(0, is_java_title)
lb_exists = FileExists (ls_pathname)
lt_curr = Now ()
ll_seconds = SecondsAfter (lt_start, lt_curr)
Sleep (0.5)
LOOP UNTIL(val > 0) OR (val = 0 AND lb_exists) OR (ABS (ll_seconds) > 5)
// OKnight, 14-FEB-2007.
logWrite (il_aurlog, "wf_start_java - val = " + string (val))