Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

calling a C++ executable from java?

  • 18-01-2005 03:13PM
    #1
    Registered Users, Registered Users 2 Posts: 978 ✭✭✭


    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, Registered Users 2 Posts: 1,243 ✭✭✭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, Registered Users 2 Posts: 978 ✭✭✭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, Registered Users 2 Posts: 1,243 ✭✭✭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, Registered Users 2 Posts: 978 ✭✭✭Glenman


    Thanks aodh, works well!
    Glenman


Advertisement