Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Dear frds

How to call the jar file using vb.net i am using one jar is with parameter another one is without parameter but both are not working please help me as soon as possible i go through the net but still i didnt fine solution

code is

C#
public void GetJar()
      {
          string output;
          string errorout;
          string path = "C:\\PATTU";
          Process process = new Process();
          process.EnableRaisingEvents = false;
          process.StartInfo.FileName = "java.exe";
          process.StartInfo.Arguments = "-jar " + '"' + path + "\\Addition.jar";
          process.Start();

          output = process.StandardOutput.ReadToEnd();
          errorout = process.StandardError.ReadToEnd();

          richTextBox1.Text = output;

      }
Posted

You probably have to provide the full path to the java.exe file and the Addition.jar file.
 
Share this answer
 
On top of what Ron siad, you're starting the process and then immediately trying to read streams that probably haven't been writen to yet, so, you get back nothing.

After the Start call, call WaitForExit on the Process object before you try to read those streams.
 
Share this answer
 
Comments
Ron Beyer 14-Jan-14 13:37pm    
Good catch.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900