Page 3 of 3 FirstFirst 123
Results 41 to 46 of 46
  1. #41
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    then i'm not too late, that code above should work.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  2. #42
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    Ok... just made a snap decision.

    I would still like to make it work this way, but if I can't, I would at least like to figure out how to start the C++ app and get output to the console for the java app, and how to send it input. Basically just reassign the java console to the C++ app until my C++ app exits. If anyone has some good code for that, I'd love to see it.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  3. #43
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    @ AB nope... your .bat file still doesn't work...
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  4. #44
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    The Process class has various get...Stream() methods for communicating with the process. You could even use System.setIn()/setOut() to directly plug the console together.

    There are plenty of JNI tutorials about. You'd just replace the main method with
    Java Code:
    JNIEXPORT void JNICALL Java_ClassName_MethodName (JNIEnv *env, jobject obj) {
         // C++ code
    }
    where ClassName and MethodName correspond to your Java code.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  5. #45
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    @Singing Boyo: weird, did you use both code and bat file together as i had it?
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  6. #46
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    weird lol... I just removed my .exe file and replaced it... may have had something to do with the fact that I was copying the exe file from where the C++ compiler put it to the directory of my Java project...

    Thanks to all for your help!

    Singing Boyo
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Executing a jar file
    By peiceonly in forum New To Java
    Replies: 7
    Last Post: 02-14-2014, 10:02 AM
  2. Replies: 2
    Last Post: 03-09-2009, 03:36 AM
  3. How to stop thread from being jumping off the code without executing it.....
    By chiragkini in forum Threads and Synchronization
    Replies: 6
    Last Post: 01-22-2009, 04:38 AM
  4. How to find file created date.....
    By roshithmca in forum Advanced Java
    Replies: 1
    Last Post: 02-18-2008, 10:48 AM
  5. Executing Ant code pragramatically
    By MikeO in forum Advanced Java
    Replies: 0
    Last Post: 07-24-2007, 10:34 PM

Posting Permissions

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