Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java in VC++

Status
Not open for further replies.

widmerts

Programmer
Jan 31, 2005
2
DE
I am writing a VC++ program that has to fetch Java source code from a file, compile and execute it at runtime, and return the result objects back to C++. Does anyone have a sample code for this or any suggestions?
 
search in the internet for some Java Parsers. After that use JNI to invoke classes. I don't know why do you need that. Would you like to create a debugger?

Ion Filipski
1c.bmp
 
Thanks. No, the thing is this: For my company I have to write a C++ test program that launches a Java compiler to compile some given code (in a file). After that, the compiled Java code must be executed and return some result objects to C++. So I have to somehow embed a Java compiler and invoke it within C++ code. Do you have any suggestions?
 
you don't have to embed any java compilers in the application. You may just use system("javac *.java") to compile java files. Or instead of system you may use exec* family functions, or CreateProcess or any function for invoking any operation system commands to launch java compiller. After that use JNI to invoke the main function from some class what contain it.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top