Currently what I do is that I check if the java.exe file exists (which it does, and the program can find it without any issues).
But when I try to run it and get the info, it fails.
The code I'm trying is the following:
Code: Select all
String path = getJavaPath();
String output = "";
if (path.Length > 0)
{
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = path,
Arguments = "-version",
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
while (!proc.StandardOutput.EndOfStream)
output += proc.StandardOutput.ReadLine();
}
Been trying different methods all night but can't seem to get it right (rhymes lol).
Anyway thanks in advance