By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,889 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,889 IT Pros & Developers. It's quick & easy.

Java from VC++

P: n/a
I am writing a VC++ program that has to fetch a Java source file,
compile it with a Java compiler, execute it at runtime, and return the
result objects back to VC++. Do you know of any sample codes to
illustrate how that works, or any suggestions?
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

ToSam wrote:
I am writing a VC++ program that has to fetch a Java source file,
compile it with a Java compiler, execute it at runtime, and return the result objects back to VC++. Do you know of any sample codes to
illustrate how that works, or any suggestions?


There are some things that you can actually do in C++ (fetch a file,
probably - what exactly do you want to do?), execute a program
( std::system("path/to/javac.compiler") or std::exec* functions ),
and IIRC the Java file that is produced can be run again using
a similar std::system command.

I'm not sure what you mean with the "result objects". The closest
thing to a result object in C++ is the single int returned from
int main( ). But I could imagine the Java program producing an
output file. You could read that back in C++. In fact, since Java
sources are just text, and C++ can manipulate text, you could also
modify the Java source text before you compile it, such that the
output objects are stored to a file.

HTH,
Michiel Salters

Jul 23 '05 #2

P: n/a
"msalters" <Mi*************@logicacmg.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
There are some things that you can actually do in C++ (fetch a file,
probably - what exactly do you want to do?), execute a program
( std::system("path/to/javac.compiler") or
std::exec* functions ),


There are no functions in the C++ standard library
whose names begin with 'exec'.

-Mike
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.