visual c++ - Is there a way to use java to execute a series of command line -


i'm looking way compile visual studio c++ project in java. know it's bit strange way. i'm doing evolutionary algorithms. java creating c++ code , compile in java not c++. need automate it, don't have copy c++ code , paste in .net , click compile it.

so i'm looking way execute series of command lines , display result in eclipse console. can that?

first need setup visual studio environment, need run batch first c:\program files\microsoft visual studio 9.0\vc\vcvarsall.bat , change directory c++ project , compile project using "cl.exe" , "link.exe". need executed in specific order.

create batch file , run using processbuilder.

   import java.io.*;    import java.util.*;     public class doprocessbuilder {      public static void main(string args[]) throws ioexception {         if (args.length <= 0) {          system.err.println("need command run");          system.exit(-1);        }         process process = new processbuilder(args).start();        inputstream = process.getinputstream();        inputstreamreader isr = new inputstreamreader(is);        bufferedreader br = new bufferedreader(isr);        string line;         system.out.printf("output of running %s is:",            arrays.tostring(args));         while ((line = br.readline()) != null) {          system.out.println(line);        }       }     }  

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -