Results 1 to 4 of 4
  1. #1
    raxwer is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default How to return command prompt error message

    Hello All,

    I am trying to compile a java file on my own server and returning its output. But if there is an error in file, we get the error message on command prompt. i just want to have that error message from command prompt and return it to the user...

    One example is this link..

    JXXX Compiler Service
    Submit a java file with an error. It will give you error message. I want the same thing. But dont know how this can be done.

    Thanks in Advance..

  2. #2
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    Please note my code is approximate, make sure to look up the API

    Java Code:
    Process p = System.getRuntime.exec("yourcommand.exe");
    
    InputStream is = p.getInputStream();
    
    // read from that stream...

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default

    compile a java file on my own server and returning its output.
    How are you doing the compile? If using Runtime and Process class, they have methods to get Streams for program's output. See above.

  4. #4
    raxwer is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    If using Runtime and Process class, they have methods to get Streams for program's output. See above.

    Hello again. Thanks for the suggestions, i am trying with the above idea. Will let you know if its working.

Similar Threads

  1. CORBA command prompt
    By ntagrafix in forum Advanced Java
    Replies: 2
    Last Post: 04-06-2010, 11:35 AM
  2. Command Prompt Java
    By kelvinsmj in forum New To Java
    Replies: 8
    Last Post: 11-27-2009, 10:30 AM
  3. How to run a project with the command prompt?
    By TexanProgrammer in forum NetBeans
    Replies: 4
    Last Post: 08-05-2009, 10:19 PM
  4. how to get the values from command prompt
    By tej in forum New To Java
    Replies: 3
    Last Post: 05-02-2009, 08:32 AM
  5. help me!!!! about command prompt..
    By kureikougaiji in forum New To Java
    Replies: 2
    Last Post: 11-13-2008, 06:15 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
  •