Running c++ from Java problem -


I need to compile and run a c ++ program from Java. I am using

Process A = Runtime.getRuntime () Executive ("G ++ G function.cpp -O Function") .; Process B = Runtime.getRuntime () Executive ("./function") ;.

The problem is that the output I received from C ++ program is not correct, but if I compile and run it in my own command line it just works fine. The problem is Java and I do not know why.

Thank you very much

Al,

And there is a potential problem that I see here. The problem is that if Runtime.ACAC ( not waits to complete the process), then you have to add

  a.waitFor (); Before calling, call  

b.

The issue is that depending on how you are applying this application, there can not be a current working directory, where you think it is. Therefore function.cpp may not exist.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -