Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    55

    Unanswered: Calling java code from c/c++

    Hi everyone,

    Is it possible to call a java code from within a c++/c code?
    If yes then whats the syntax/code for it...please help
    If not then how can I call a c program which will invoke a java progam if certain conditions are satisfied..
    Any ideas/help/scripts/links are welcome

    cheers
    -s
    You try and try again..but then give up, there's no sense in being a complete fool about it!!!

  2. #2
    Join Date
    Apr 2003
    Posts
    40
    There is no way to call a Java program directly from a C(++) program without some external help.
    If you have the resources available, you can do a call via for example Corba or HTTP (let the Java program be a Java servlet and have the C++ program send an HTTP request to it and capture the result for example).

    A cheaper method is to set up direct communication between the two over TCP/IP and write your own custom protocol (which could be very simple depending on your needs).

  3. #3
    Join Date
    Jan 2003
    Posts
    55
    no need for all this confusion
    I simply used the 'system' call from my c++ code to first compile and then execute my java program

    works fine..
    thnx for the help anyway...

    shuchi
    You try and try again..but then give up, there's no sense in being a complete fool about it!!!

  4. #4
    Join Date
    Aug 2003
    Location
    Fredericksburg, VA
    Posts
    1
    Do you know if you can return information from the java program back into the c program using the system call?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •