Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

calling a C++ executable from java?

Options
  • 18-01-2005 3:13pm
    #1
    Registered Users Posts: 976 ✭✭✭


    Hi all,
    For my final year project, I have a java server running on a computer receiving robot direction instructions from a client. Does anyone know of any java code to call a C++ executable file? The C++ code will control and send the directions instruction to a NI-DAQ card
    Some assistance would be greatly appriciated
    Glenman


Comments

  • Registered Users Posts: 1,242 ✭✭✭aodh_rua


    Glenman wrote:
    Hi all,
    For my final year project, I have a java server running on a computer receiving robot direction instructions from a client. Does anyone know of any java code to call a C++ executable file? The C++ code will control and send the directions instruction to a NI-DAQ card
    Some assistance would be greatly appriciated
    Glenman

    Do you need to pass instructions from the Java code to the C++ code? If not use Java to get a runtime and then use this to execute your C++ code.

    Example:

    Process myProcess = Runtime.getRuntime().exec("path to exe");


  • Registered Users Posts: 976 ✭✭✭Glenman


    Thanks Aodh,
    No I don't need to pass any instructions from the java to the C++ code. I just need to call the C++ executable;
    Should this line on its own do the trick?;

    Process myProcess = Runtime.getRuntime().exec("path to exe");

    providing I fill in the path to the C++.exe program of course


  • Registered Users Posts: 1,242 ✭✭✭aodh_rua


    Glenman wrote:
    Thanks Aodh,
    No I don't need to pass any instructions from the java to the C++ code. I just need to call the C++ executable;
    Should this line on its own do the trick?;

    Process myProcess = Runtime.getRuntime().exec("path to exe");

    providing I fill in the path to the C++.exe program of course

    Should do - it might need a try\catch exception around it. If it's still giving you bother let me know.


  • Registered Users Posts: 976 ✭✭✭Glenman


    Thanks aodh, works well!
    Glenman


Advertisement