Java from VC++

Discussion in 'C++' started by ToSam, Jan 31, 2005.

  1. ToSam

    ToSam Guest

    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?
     
    ToSam, Jan 31, 2005
    #1
    1. Advertising

  2. ToSam

    msalters Guest

    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
     
    msalters, Jan 31, 2005
    #2
    1. Advertising

  3. ToSam

    Mike Wahler Guest

    "msalters" <> wrote in message
    news:...
    > 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
     
    Mike Wahler, Jan 31, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Novice
    Replies:
    1
    Views:
    1,203
    Mike Schilling
    Jul 19, 2003
  2. Michael Kintner
    Replies:
    0
    Views:
    872
    Michael Kintner
    Nov 30, 2003
  3. Ilias Lazaridis
    Replies:
    0
    Views:
    609
    Ilias Lazaridis
    Feb 1, 2005
  4. manish sahu
    Replies:
    3
    Views:
    1,038
  5. Isaac
    Replies:
    0
    Views:
    396
    Isaac
    Jan 20, 2011
Loading...

Share This Page