المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Executing Java Object in C#



C# Programming
05-12-2009, 03:00 PM
I have this task, i need to call a Java Application using a web-service call.I need to know if someone has a clue on how to do that,so far this is my attempt.

string cmd ="C:\Program Files\Java\jre1.6.0\bin\Java.exe";
//We use this command to invoke or start the java application which take argument infront.

string cmdParams="java -Xms32m -Xmx1g -Djava.library.path=d:\cep\col\sql -classpath d:\cep\col\commons-net-1.4.1.jar;d:\cep\col\commons-codec-1.3.jar;d:\cep\col\sql\sqljdbc.jar;d:\cep\col\DialogInput.jar za.co.lightWave.control.DialogInputControl";


using (Process process = Process.Start(new ProcessStartInfo(cmd, cmdParams)))
{

process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError= true;

process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

process.Start();

process.WaitForExit(timeout);
return process.ExitCode;
}


I need to know what is an effective way of executing that command,what i have currently is
java.lang.NoClassDefFoundError: java Exception in thread "main"

Thank you in advance
Mninawa