I successfully can run an anylogic model using a standalone java application and I run a .bat file without any problem on my windows 10.
this is the image of run description in this case;
but when I call the same .bat file through c# application, the run log description differs from start and the model does not run. the image of run log description is:
in first image after the directory, java.exe file is called and then -cp command is called. but in second image after directory -cp command is called immediately. And the model does not run as well. what is wrong and what should I do to solve the problem?
P.s. the code of calling batch file is as follows:
try
{
ProcessStartInfo procInfo = new ProcessStartInfo();
procInfo.UseShellExecute = true;
procInfo.FileName = @"directory and file.bat"; //The file in that DIR.
procInfo.WorkingDirectory = @"dirctory"; //The working DIR.
procInfo.Verb = "runas";
Process.Start(procInfo); //Start that process.
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
CodePudding user response:
This a common problem with .bat launcher on corporate systems as it expects java to be in a certain location. I would advise to edit the .bat file and replace %PATH_XJAL% used in the command to launch the model with just 'java' - this usually works as java will be somewhere in the system PATH variable.