Thread: interfacing c and java..

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    46

    interfacing c and java..

    i am doing a project in c... but it needs GUI at user side....designing GUI using C language i heard that its very difficult... so i thought of doing the GUI using java program.... so now i have to interface c program and java program... please tell me anybody how to do that... and if their is any tutorial which teaches interfacing then mention it.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    JNI.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    14
    I was in the exact scenario as you about two weeks ago, and what I ended up doing was :

    In Java :
    create a new batch file
    write the c program name
    write the parameters you want to pass to the C Program

    Execute the batch file


    In C:
    Have your program accept command line arguments (int argc, char **argv) and act appropriately

  4. #4
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    You definitely want to be using the JNI.

    If youre using netbeans then this should get you going: http://cnd.netbeans.org/docs/jni/beginning-jni-win.html

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Man... using JNI in my opinion is no less work than just slapping together a GUI. I guess it depends on the nature of the beast, so to speak. Depending on the complexity of the GUI and other elements of your program it may merit dealing with the API...

Popular pages Recent additions subscribe to a feed