Problem with calling a run file from c# Application -


I'm using the C # application to call a batch file that compiles and runs Java programs (This is a scraping project that captures material from websites.) The batch file contains the following commands:

java -classpath core.jar; Mysql.jar; Realtouch.jar; Com.parser.MainClass C: / wamp / www / C21_real2 / property http://www.realestate.com.au/realestate/agent/century+21+harbasside+neutral+bay/tzrjnd

This batch file is working fine, when I go to the folder and double click on the batch file. But when I call this run file through my code using System.Diagnostics.Process , then it says:

main square com. Could not find parser.MainClass The program will now exit.

and the command window will exit from within seconds.

I am calling the program from C # as follows:

  process batch = new process (); String pathtoRunFile = "E: \\ newFiles \\ run.bat"; Batch Startinfo.philname = pathfun file; Batch Start Info. Body = ""; Batch Startinfo Usse shellexicut = true; Batch.Start (); Batch.WaitForExit ();  

Please help someone please ASAP I am really confused why this is not working when I am calling it from my application. I'm not a more Java developer, so is this a problem in my main Java program? If so, how to solve it? I need to run a batch file from my C # application.

Newfiles The structure of the folder is as follows (only the files)

  • Corezar
  • mysql.jar
  • realtouch.jar
  • run.bat

Set up the work directory:

  Batch. Startinfo Working directory = "e: \\ newfiles";  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -