Back Forum Reply New

read projectx standard output

Hi

I'm trying to read the standard output from ProjectX from a .Net application. ProjectX is a Java application and regular (c sharp)Code:
Process p = new Process();
StreamWriter sw;
StreamReader sr;
StreamReader err;

ProcessStartInfo psI = new ProcessStartInfo(quot;cmdquot;);
psI.UseShellExecute = false;
psI.RedirectStandardInput = true;
psI.RedirectStandardOutput = true;
psI.RedirectStandardError = true;
psI.CreateNoWindow = true;
p.StartInfo = psI;

p.Start();
sw = p.StandardInput;
sr = p.StandardOutput;
err = p.StandardError;
doesn't seem to work. Does anyone know how I can capture this info without using executable wrappers? Or if you just have general advice about launching java apps from .Net.. : )

Ac3Dc3

ProcessStartInfo psI = new ProcessStartInfo(quot;cmdquot;);

Umm.. what's the purpose of this? Do you really need a commandprompt wrapper? And if so, it's cmd.exe and you need to specify a path. If there's a way to control projectx from the commandline, your launching application needs to be java.exe.. after all you launch ProjectX from the commanprompt via a line like quot;java.exe packagename.ProjectX argument1 argument2 argument2quot;.. so java.exe including the full path goes as the application, and the rest as arguments for your PSI.

sorry, the code was probably misleading - i just meant to give an example of running a process from .Net (cmd.exe  )

ohhh yeahh i should have gone back to basics and thought about what runs the jar executable.. im now capturing the output of java.exe and giving it the arguments

-jar [path to compiled projectX.jar] projextXargument1 etc

and projectX definately does have a cli, its short but sweet! thanks for helping out a java n00b

btw is there a way of quickly ascertaining the path to java.exe on a users system?

System.Environment.EnvironmentVariable (or thereof.. I'm typing off my head), and the variable is called Java_Home or something like that (do a set, look for java and you shall find).
¥
Back Forum Reply New