Tuesday, 15 April 2014

.net - Can't get java version using process standard output (VB.NET) -



.net - Can't get java version using process standard output (VB.NET) -

i need java version, need java process parameter "-version"

it works on cmd, , not work on code. and, create java process well. can't output.

what need solve problem?

dim javaproc new process() dim javaprocinfo new processstartinfo("java", "-version") javaprocinfo .useshellexecute = false .redirectstandardoutput = true end javaproc .startinfo = javaprocinfo .start() end dim soutput string using sreader system.io.streamreader = javaproc.standardoutput soutput = sreader.readtoend() end using msgbox(soutput)

the version sitting on standarderror stream. below modified code block; notice standarderror stream needs redirected.

dim javaproc new process() dim javaprocinfo new processstartinfo("java", "-version") javaprocinfo .useshellexecute = false .redirectstandarderror = true end javaproc .startinfo = javaprocinfo .start() end dim soutput string using sreader system.io.streamreader = javaproc.standarderror soutput = sreader.readtoend() end using msgbox(soutput)

java .net vb.net process output

No comments:

Post a Comment