tags:

views:

101

answers:

1

Hey, i need to run a cpp propgram from a java application. I have Visual Studio and Eclipse. I have all of the cpp files and also a .mak file which i'm not sure about how it could help me...

any help or direction would be welcome!

+3  A: 

Do you want to actually run the final application? This seems more like you want to build it.

Either way you can use:

java.lang.Runtime.getRuntime().exec(command, environment)

To run a process from Java like running it from a console.

See http://java.sun.com/javase/6/docs/api/index.html?java/lang/System.html for details.

cyborg
As he says he has sources and a makefile, this seems unlikely.
anon
I wand to run the final appliction. of course i need to build it firs in order to create the exe file. What is the command argument needed in order to build the project? Neil what do you mean unlikely?Thank you very much!
Jose
I cannot remember off-hand but you should be able to work it out by looking at the build output window (I don't have one here to check against to see what it would be).If you wanted to get really fancy you would try to work out what the project build would be from the csproj files but just having some hardcoded steps would be the first thing.
cyborg
The command may be something like `make makefile`. Or a more foolproof command: `make -f /directory_to_makefile/makefile`.
Thomas Matthews