Results 1 to 3 of 3
  1. #1
    sara12345 is offline Member
    Join Date
    Dec 2009
    Rep Power

    Default Urgent! executing c code from java

    I need to execeute or call whole c program from java.
    the c program works as follows:
    it take input file from the command line and it return output file
    I have used the following java code to call c code\
    Java Code:
         String line;
    	           String output1 = "";
    	                 Process p = Runtime.getRuntime().exec("cp1.exe");
    	                 BufferedReader input = new BufferedReader
    	                       (new InputStreamReader(p.getInputStream()));
    	                 while ((line = input.readLine()) != null) {
    	                       output1 += (line + '\n');
    although the c code works fine when it is executed from visual c++ also the exe file works fine but when I call exe file from java it doesn't work
    can please tell me what shall I do??

  2. #2
    ojn is offline Senior Member
    Join Date
    Aug 2008
    Stockholm, Sweden
    Rep Power


    Urgent? Damn, probably too late then. :(

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    How is this post different from your other thread other than the "urgent" heading? Cross-posting (which is against forum rules) and pressuring volunteers for help will usually have the opposite effect.

    I'm locking this thread but will unlock it if you can justify its existence.

Similar Threads

  1. Problem executing .exe file created with C++ code
    By Singing Boyo in forum Advanced Java
    Replies: 45
    Last Post: 05-30-2009, 12:39 AM
  2. 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, 03:38 AM
  3. code HELP URGENT
    By NickkicN in forum New To Java
    Replies: 1
    Last Post: 08-14-2008, 05:43 PM
  4. Urgent small code
    By karingulanagaraj in forum New To Java
    Replies: 7
    Last Post: 08-11-2008, 04:11 AM
  5. Executing Ant code pragramatically
    By MikeO in forum Advanced Java
    Replies: 0
    Last Post: 07-24-2007, 09: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