如何在vb.net 2010 Web应用程序中调用jar文件 [英] how to call the jar file in vb.net 2010 web application

查看:166
本文介绍了如何在vb.net 2010 Web应用程序中调用jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨亲爱的朋友们

如何使用vb.net调用jar文件我使用的是一个带有参数的jar,另一个没有参数,但是两者都不起作用,请尽快通过网络帮助我,但仍然无法解决问题

代码是

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

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;

      }

推荐答案

您可能必须提供java.exe文件和Addition.jar文件的完整路径.
You probably have to provide the full path to the java.exe file and the Addition.jar file.


在Ron siad的基础上,您正在开始该过程,然后立即尝试读取可能尚未写入的流,因此您一无所获.

在Start调用之后,请在尝试读取这些流之前,在Process对象上调用WaitForExit.
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.


这篇关于如何在vb.net 2010 Web应用程序中调用jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆