Capturing verbose output from javac??

I am tyring to capture the verbose output from javac.
From a UNIX shell, I type "javac -verbose Test.java 2> dump.txt" and it works fine.
The trick is that I want to do this within a Java program. I have the following code, but I can't seem to find a solution. Any help is appreciated.
import java.io.*;
public class GetTree {
public static void main(String[] args) {
     try {
     Runtime r = Runtime.getRuntime();
     String options = "-verbose";
     // The java file to compile.
     String fileName = args[0];
     String command = "javac " + options + " " + fileName + " 2>dump.txt";
// This doesn't even create the 'dump.txt' file!?
     Process p = r.exec(command);
     catch (Exception e) {
     System.err.println(e);
-----------------------------------------------------------------------

Try this...
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
appu

Similar Messages

  • How to capture graphical outputs from other programs

    Does anyone know how we capture the graphical outputs from the other programs and show them
    on the swing?
    I'd like to use a java program to run gnuplot, capture the outputs, and show them using swing.

    Depends on what you mean by "graphic outputs".
    Taking a quick glance at the gnuplot homepage, it looks as if you can output to PNG files, so just run the app, and load the png file.

  • Capturing the output from jsp selvlet

              Hi,
              I have a requirement where I need to capture the output of the JSP generated servlet
              , and do something with it before it get's to the client side.
              Has someone done something like this before.Any ideas, suggestions .
              Thanx,
              Tajdar
              

    You can set the MIME content type as .doc and try to open the Page.
    res.setContentType("application/vnd.ms-excel"); to generate the Page output as Excel
    res.setContentType("application/vnd.ms-word"); to generate the Page output as MS Word doc
    Hope this helps..

  • Capture pasta output from concurrent

    Hello at all.
    A simple question:
    I need to print a PDF report with pasta.
    In preprocess phase i generate the postscript version of document with a bash script.
    I want write the message generate by script into concurrent log's. is possible ?
    Thanks

    Hi,
    Append the message you want to the log file of the concurrent request - you have control over the command called by the preprocess script already.
    Regards,
    Gareth
    Blog: http://garethroberts.blogspot.com/

  • Capturing print command output from procedures

    Is it possible to capture the output from print statements in stored procedures such as the "print" command in Sybase stored procedures? This information doesn't seem to come through the result set.
    Thanks,
    KP

    This will be database specific. Please consult your database documentation.

  • Redirecting output from plink

    I am currently trying to write a function that runs plink and captures the output from that process.  When I try StandardOutput I get nothing and when I try StandardError I get "Unable to read from standard input: The handle is invalid."  I can only assume that this means I am trying to read while plink is waiting for input.  I am also passing my command via a text file called apCommands.txt.  When I run this command manually it works and gives me the required output, I just can't figure out why I can't redirect that output so I can store it in a results file.  Here is the code I have right now.
    string pArgs = "-m \"" + ABSPATH + "\\apCommands.txt\" -ssh myHost -l user -pw password";
    string output;
    if (File.Exists(ABSPATH + "\\apTest.txt"))
    File.Delete(ABSPATH + "\\apTest.txt");
    StreamWriter apTest = new StreamWriter(ABSPATH + "\\apTest.txt");
    Process runAP = new Process();
    ProcessStartInfo apInfoStart = new ProcessStartInfo(ABSPATH + "\\plink.exe");
    apInfoStart.Arguments = pArgs;
    apInfoStart.RedirectStandardOutput = true;
    apInfoStart.CreateNoWindow = true;
    apInfoStart.UseShellExecute = false;
    runAP.StartInfo = apInfoStart;
    runAP.Start();
    output = runAP.StandardOutput.ReadToEnd();
    runAP.WaitForExit();
    apTest.WriteLine("Standard Output");
    apTest.WriteLine(output);
    apTest.Close();
    runAP.Close();
    Thanks,
    Joe

    I see.  I wasn't aware that it wasn't a reliable way to connect to ssh.  As for the error message that was from standardError.  I think the process may have been waiting for input when I was trying to read from StandardOutput and thats why I got that error message.  Also instead of redirecting StandardOutput I tried redirecting the output directly into a file by running a cmd process and passing the commands I wanted to run through StandardInput.  The underlined section is all I changed besides running this inside of a cmd process.  This did work for me but I would rather know how to do it using StandardOutput. 
    string dArgs = "cd \"" + ABSPATH + "\"";
    string pArgs = "plink -ssh myHost -m \"" + ABSPATH + "\\apCommands\" -l user -pw password > test.out";
    Process runAP = new Process();
    ProcessStartInfo apInfoStart = new ProcessStartInfo("cmd");
    //apInfoStart.Arguments = pArgs;
    apInfoStart.RedirectStandardInput = true;
    apInfoStart.RedirectStandardOutput = true;
    apInfoStart.CreateNoWindow = true;
    apInfoStart.UseShellExecute = false;
    runAP.StartInfo = apInfoStart;
    runAP.Start();
    runAP.StandardInput.WriteLine(dArgs);
    runAP.StandardInput.WriteLine(pArgs);
    I haven't tried reading the StandardOutput from this piece of code, but I will probably try it.
    Thanks,
    Joe

  • Capturing Program Output

    I have a program in which I want to capture the output generated when I run the class. The function is off in another java file that I have imported into this one. Some of the code is below.
    Tester controllerTester = new Tester();
    controllerTester.runtest(testArray);
    runtest outputs information via System.out.println and I am wanting to capture that information. How do I go about doing this? I have sucessfully captured output in another program that executes an external program with the Process p = Runtime.getRuntime().exec(program) command. I just need to know how to capture the output from runtest above. Any help would be appreciated.
    Thanks...Chris

    Runtime.getRuntime().exec(program) command. I just
    need to know how to capture the output from runtest
    above. Any help would be appreciated.[url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#setOut(java.io.PrintStream)]System.setOut(PrintStream) might be of help. Though it'll capture any output to system out, not only that produced by the method you mention (no problem if the code is executed in a single-threaded environment).

  • Capturing output from Runtime.exec()

    I want to be able to get the jvm version by calling "java.exe -version" from within a java application. The following code executes fine (given all the stuff I left out of this post) except for the fact that the inputstream only reads null from the process.
    Anybody have any ideas of why I can't capture the output? This same code works fine if I execute a bat file which calls "java -version".
    final private String[] versionInfo ={"cmd","/c","\"C:\\Program Files\\java\\bin\\java\"", "-version"};
    try{
                   //execute new process
                   System.out.println("executing process");
                   Runtime runtime = Runtime.getRuntime();
                   Process proc = runtime.exec(cmd,env);
                   System.out.println("initializing streams");
                   //read output
                   InputStream inputstream = proc.getInputStream();
                   InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
                   BufferedReader bufferedreader =     new BufferedReader(inputstreamreader);
                   String line;
                   System.out.println("reading output");
                   while ((line = bufferedreader.readLine())!= null){
                        System.out.println("read something");
                        System.out.println(line);
                        outputText.append(line);
                        outputText.append("\r\n");
                        outputText.update();
                   System.out.println("finished reading");
                   //check for errors
                   try {
                        if (proc.waitFor() != 0) {
                             System.err.println("exit value = " + proc.exitValue());
                   }catch (InterruptedException e) {
                        System.err.println(e);
              }catch(Exception e){
                   e.printStackTrace();
              System.out.println("exiting execute method");

    What's wrong with just using one or more of the following System Properties?
    java.vendor=Sun Microsystems Inc.
    java.vendor.url=http://java.sun.com/
    java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi
    java.version=1.4.2_04
    java.vm.info=mixed mode
    java.vm.name=Java HotSpot(TM) Client VM
    java.vm.specification.name=Java Virtual Machine Specification
    java.vm.specification.vendor=Sun Microsystems Inc.
    java.vm.specification.version=1.0
    java.vm.vendor=Sun Microsystems Inc.
    java.vm.version=1.4.2_04-b05If you insist on using an external process, this article may help.
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Where do I find output from verbose:class?

    I want to find out where a class is being loaded from. So, using the config tool, I have added "-verbose:class" to the server's Java parameters and restarted. However, I cannot find the logging file that contains the expected output from enabling this option. What file do I look in? It's not in server0/log/defaultTrace.trc nor server0/kernel/classload/default.trc.

    hi,
    the following link gives u the details about the usage of verbose:class.. its an extract from a book..
    it opens only if you a g-mail account.. if u don have i can send u an invite
    http://books.google.co.in/books?ie=UTF-8&hl=en&vid=ISBN0201753065&id=CvvdZtzxnAEC&dq=outputfromverboseclass&vq=outputfromverboseclass&prev=http://books.google.co.in/books%3Fq%3Doutput%2Bfrom%2Bverbose%2Bclass&lpg=PA45&pg=PA45&sig=SV45ZjMHXGi87y0GR7CLOOFA3_w
    hope it might help you,
    naveen

  • How to capture output from Runtime.exec() ?

    Hi,
    Well, the question is in the subject ...
    I'd like to capture the output of a process ran by Runtime.exec() in order to process it.
    thanks,
    ionel

    Okay ...
    Sorry for the post !
    I found the solution : Runtime.exec().getOutputStream()
    Thanks however
    ionel

  • Capturing a command output from unix

    Hi All
    I am using enchanter to connect to unix and running a command but how do i capture the output of the command. Follwoing is the code i used.
    import java.io.IOException;
    import org.twdata.enchanter.SSH;
    import org.twdata.enchanter.impl.DefaultSSH;
    public class connect {
              public static void main(String[] args) throws IOException {
                   SSH ssh = new DefaultSSH();
                   ssh.connect("ip address", 22, "username", "pwd");
                   ssh.sendLine("ls -lrt");          
                   System.out.println(ssh.getLine());               
                   ssh.disconnect();
    }Thanks
    Diana

    [http://code.google.com/p/enchanter/]

  • Unable to output from FCP to Canon XL1.

    I have an eMac with Final Cut Pro 4.5 HD. I also have a Canon XL1 3 CCD camcorder.
    I have no problem capturing footage from my camcorder to my eMac on FCP. I can also connect my Canon to my VCR and record off my camcorder to my TV, as well as play the tape on my camcorder to watch it on TV.
    However, I cannot output from FCP to my camcorder. The 4 to 6 FireWire is attached to both the camera and the eMac and I checked the Log and Capture feature and FCP does recognize a camera or deck is attached. I've been trying to output it using manual record in which I press record on my camcorder and play the playhead on FCP. As I record, there is no picture on my viewfinder, nor any audio being recorded and when I play it back, I just get this blank blue screen, but the timecode is recorded.
    Am I missing something here?

    ensure the following are set
    View>Video Playback>Firewire Apple 720x480 (NTSC or PAL - whatever is appropriate)
    View>Audio Playback>Audio follows video
    View>External Video>All Frames
    If this isn't what you are set to do, you won't be sending video out to your recorder.
    x

  • Unable to Capture ALV output in an Internal Table, after CALL TRANSACTION

    Dear all,
    My requirement is to run multiple materials in T-code CK86_99 but as we know CK86_99 is only adequate to one material at a time.
    So, I want to capture the Output of the T-code in my Internal table with respect to all the Material Numbers I use in the Select-Options of my Z Program.
    Below is the Code I developed so far, but the Class
    cl_salv_bs_runtime_info=>get_data_ref(
            IMPORTING r_data = lf_ref ).
    is not capturing the Ouput...
    Please have a look and enlighten me how it could be solved.
    TABLES : mara.
    DATA : BEGIN OF wa_mara,
      matnr TYPE mara-matnr,
      END OF wa_mara.
    DATA: it_bdcdata TYPE TABLE OF bdcdata,
          wa_it_bdcdata LIKE LINE OF it_bdcdata,
          it_mara LIKE TABLE OF wa_mara.
    *      BELNR(10).
    FIELD-SYMBOLS:<fs_tab> TYPE ANY TABLE,
    <fs_line> TYPE any.
    DATA:lf_ref TYPE REF TO data,
         lf_ref1 TYPE REF TO data.
    SELECT-OPTIONS so_matnr FOR mara-matnr.
    PARAMETERS p_werks LIKE t001w-werks.
    *BELNR = 'Z92'. " Give Document Number here
    SELECT matnr FROM mara INTO TABLE it_mara WHERE matnr IN so_matnr.
    DATA opt TYPE ctu_params.
    LOOP AT it_mara INTO wa_mara.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-program  = 'SAPMKKB0'.
    wa_it_bdcdata-dynpro   = '0300'.
    wa_it_bdcdata-dynbegin = 'X'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'KKB0-MATNR'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'KKB0-MATNR'.
      wa_it_bdcdata-fval = wa_mara-matnr.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_CURSOR'.
    wa_it_bdcdata-fval = 'KKB0-WERKS'.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
      wa_it_bdcdata-fnam = 'KKB0-WERKS'.
    wa_it_bdcdata-fval = p_werks.
      APPEND wa_it_bdcdata TO it_bdcdata.
      CLEAR wa_it_bdcdata.
    wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    wa_it_bdcdata-fval = 'OSNY'."'ONLI'."=CRET'.
      APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-program  = 'SAPLKKRSOO'.
    * wa_it_bdcdata-dynpro   = '0100'.
    * wa_it_bdcdata-dynbegin = 'X'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    *  wa_it_bdcdata-fval = 'BACK'."=CRET'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-program  = 'SAPMKKB0'.
    * wa_it_bdcdata-dynpro   = '0300'.
    * wa_it_bdcdata-dynbegin = 'X'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
    *  CLEAR wa_it_bdcdata.
    * wa_it_bdcdata-fnam = 'BDC_OKCODE'.
    * wa_it_bdcdata-fval = 'EXIT'."=CRET'.
    *  APPEND wa_it_bdcdata TO it_bdcdata.
      opt-dismode = 'N'.
    cl_salv_bs_runtime_info=>set(
        EXPORTING display  = abap_false
                  metadata = abap_true
    data     = abap_true ).
      CALL TRANSACTION 'CK86_99' USING it_bdcdata OPTIONS FROM opt.
      TRY.
    cl_salv_bs_runtime_info=>get_data_ref(
            IMPORTING r_data = lf_ref ).
          ASSIGN lf_ref->* TO <fs_tab>.
        CATCH cx_salv_bs_sc_runtime_info.
          MESSAGE 'Unable to retrieve ALV data' TYPE 'E'.
      ENDTRY.
    cl_salv_bs_runtime_info=>clear_all( ).
      IF <fs_tab> IS ASSIGNED.
        CREATE DATA lf_ref1 LIKE LINE OF <fs_tab>.
        ASSIGN lf_ref1->* TO <fs_line>.
      ENDIF.
    *LOOP AT <FS_TAB> ASSIGNING <FS_LINE>.
    *ENDLOOP.

    Hi Abhay,
          If you go to Transaction code SE93, enter the tcode "CK86_99" and click display, you may see the default value for transaction is "KKBB" and the screen field for P_SCREEN = 0300, P_TCODE = ck86_99.
          You may need to copy the transaction code "KKBB" and go to SE93 again, enter the tcode for "KKBB" then click display, now you may see the program name is "RKKB1000".
          Hope this answer your question.
    Thanks
    Hock Lin

  • How can I connect my svideo output from my camcorder to my Macbook pro retina?

    How cn I connect the s video output from my camcorder to my 13" macbook pro retina?

    Buy a video to USB converter.
    Buy a more expensive video to Firewire converter (it may give better quality).
    Find an older mini DV camera with 'video in' to make transfers to tape to capture from.

  • Capturing the output of a os command line

    I need to capture the output of a os command line executed from one java program and I don't know how can do it.
    For example:
    Runtime.getRuntime().exec("hostid");

    Your suggestion worked very well, just in case that this could interest somebody, this is the complete solution
    Thanks for your help
    import java.io.*;
    public class HostID
    public static void main(String args[]){
    try{
    InputStream in = (Runtime.getRuntime().exec("hostid")).getInputStream();
    byte[] arreglo= new byte[200];
    int cantidad = in.read(arreglo);
    System.out.println(new String(arreglo,0,cantidad));
    } catch (IOException ioe){System.out.println(ioe.getMessage());}
    }

Maybe you are looking for

  • My iPhone isn't showing up as a device in iTunes

    I just downloaded iTunes and plugged in my iPhone 4s to my computer. My music from my phone shows up in iTunes, but it does not show my device. I'm trying to download music from my computer, but I cant without transferring it to the device. I hope th

  • Toshiba Control buttons don't work - Portege R200

    Hello, Hi I formatted my Toshiba Portege R200 reinstalling Windows and drivers without the recovery disc. The problem is that after installing everything, I work the shortcut keys (Toshiba controls enabled in control panel to assign function keys). I

  • Html comment in JSP compiled and rendered in NW7.3?

    Hi, We are updateing from EP NW7.0 to NW7.3 and are facing a strange issue with html comment (<!-- -->) in JSP files. It seems as in 7.3 html comment is compiled and rendered but of course does not work. Is this correct or is it a bug? Thanks, Stefan

  • My Safari quit altogether on my iMac

    My Safari quit altogether and I had a hard time getting back on.

  • How to duplex print pdf file on hp 1320 using upd pcl5 on windows 7 ?

    I am running Windows 7 Professional (64bit), with a HP laserjet 1320 using driver HP UPD PCL5 (v5.5.0.12834), with Adobe Acrobat 9 Pro v9.5.2 and MS Word 2010. When I print a Word 2010 file I can choose duplex printing (print on both sides) and every