Get output from dos window to jtextarea

the code is:
Runtime r=Runtime.getRuntime();
Process p=r.exec("javac <filename>");
i have used
BufferedReder br=new BufferedReader(new InputStreamReader(p.getOutputStream));
but on compilation it shows error
plz someone help
i need it urgently.

Sorry, this < was the wong way around
Process p=r.exec("java filename >test.txt")
Then read in data from test.txt, something like this should do it :))   public String getTextFile(String text) throws Exception{
      int reader = 0;
      text = "";
      FileReader in = new FileReader("test.txt");
         do {
            reader = in.read();
            text += (char)reader;
         }  while (reader != -1);
      in.close();
      return text;

Similar Messages

  • Get output from dos window to jtextarea/textarea

    hi
    i am executing the following lines of code:
    1)Runtime r=Runtime.getRuntime();
    Process p=r.exec("javac <filename.java>");
    when executing this there is no exception fired but i am not being able
    to get the output from the ods console to a textarea
    or for that matter i donot get any output anywhere
    2)if i change it to
    Process p=r.exec("java <filename");
    similar thing happens i.e no output
    can anyone plz help
    thanx.

    Sorry, this < was the wong way around
    Process p=r.exec("java filename >test.txt")
    Then read in data from test.txt, something like this should do it :))   public String getTextFile(String text) throws Exception{
          int reader = 0;
          text = "";
          FileReader in = new FileReader("test.txt");
             do {
                reader = in.read();
                text += (char)reader;
             }  while (reader != -1);
          in.close();
          return text;

  • My HP wireless printer keeps getting deleted from my windows 7 PC. Why?

    I have a HP Photosmart D110A e-printer and every once and awhile it get deleted from my Windows 7 PC and I have to add it again, What is going on with this. Any tips would be great.

    It should.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • I dont have data in "Client status summary" report for servers in server collection, but get data from our Windows 7?

    Hi,
    I dont have data in "Client status summary" report for servers in server collection, but get data from our Windows 7?
    So and idea of way I dont get data from or servers? Missing client setting for servers?
    /SaiTech

    Hi,
    I do see the server in Server collections in "Monitoring--Client Status--Client Activity" but not in reports like "Clients with failed client check details" i get "No Data Available"?
    /SaiTech

  • Getting output from a process

    hi friends and gurus!
    can somebody give me actuall working code to get the
    output from a process let's say Process p=Runtime.exec("cmd c/ dir c:"); in windows,
    and stores the output in a textfile let's say out.txt.
    please give me the java code and not hints!
    any effort to help me will be highly appreciated.
    Thanx in advance!
    sparya.

    import java.io.File;
    import java.io.FileReader;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.FileNotFoundException;
    class read{
    public static void main(String[] args){
    String data=""
      try{
       BufferedReader reader=new BufferedReader(new FileReader(new File(args[0])));
       while((data=reader.readLine())!=null){
        System.out.println(data);
      catch(FileNotFoundException fnfe){
       System.out.println("cant find file "+args[0]);
      catch(IOException ioe){
       System.out.println("cant read file "+args[0]);
    }to use type java read filename (including path if you need it)
    hint, type java read read.java (cool, its nearly a palindrome)

  • Writing console output from numerous classes to JTextArea?

    I have written a GUI for several classs and I was wondering if it is possible to have the output from these classes written to something like a JTextArea or equivalent.
    I know I could store the output (instead of System.out.print) and then setup a JTextArea and set the text equal to the stored output. I was hoping there was another way to do this that'd be more aesthetic.
    Thanks in advance.
    Se�n

    I have written a GUI for several classs and I was
    wondering if it is possible to have the output from
    these classes written to something like a JTextArea
    or equivalent.
    I know I could store the output (instead of
    System.out.print) and then setup a JTextArea and set
    the text equal to the stored output. I was hoping
    there was another way to do this that'd be more
    aesthetic.
    java.util.logging?Alternatively, create a TextAreaPrintStream class, overriding the appropriate methods and then call
    System.setOut(someTextAreaPrintStream);Jim S.

  • Error Getting Output From ICloudTask

    I went through the Azure Batch Tutorial for .NET and am having issues with getting the output from the ICloudTask. After waiting for the tasks to complete I have the coded below:
    foreach (ICloudTask task in listjob.ListTasks())
    string taskFileContent = task.GetTaskFile(Constants.StandardOutFileName).ReadAsString();
    Console.WriteLine("Task " + task.Name + " says:\n" + taskFileContent);
    It throws a System.AggregateException on task.GetTaskFile with an inner exception of:
    {"The remote server returned an error: (404) Not Found."}
    I did some research but haven't been able to determine why I am getting this error?

    I see in the sample that the second use of TaskStateMonitor (TSM) does not check for timeout...  We will add this and you might want too as well.  
    If the TSM times out you might want to confirm the pool has VMs and that they reach TVMState.Idle (i.e.: are available to run tasks).
    You do not mention the exact task state you see but it is possible for a task to be in the TaskState.Completed state and still not have a stdout.txt file.
    You could list the files with ICloudTask.ListTaskFiles(recursive: true) to see what files are actually there.
    Also you can check the exit code (ICloudTask.TaskExecutionInformation.ExitCode) and/or the the TaskSchedulingError (ICloudTask.TaskExecutionInformation.SchedulingErrro) to see if the task ran correctly.
    daryl
    ps: don't forget to ToString() the inner BatchException.  I posted to the forum earlier on this and there are data in the exception that can tell you more than "not found"... 

  • Configuring DNS when clients get DHCP from a Windows server

    Hi
    I'm getting to grips with OD and have managed to configure a test environment at home with static IPs and all the DNS entries being entered manually for each computer.
    However, how do I configure the DNS in an environment where clients get their IPs from a Windows DHCP server (which I have no access to)?
    Setting clients to have static IPs is not an option nor enabling DHCP on the Mac server, I suspect.
    Your help is really appreciated.
    Steve

    Hi
    Your suspicion is correct.
    To be honest I would what is available on the Windows Server as the basis for your Open Directory deployment. If the Windows Server is already the DHCP Server odds are it is also the DNS Server. DNS can be provided to your clients using the Windows based DHCP service.
    If you have no direct access to the windows server you should be able at the least ask the windows administrator to add a Host Record with a Reverse Pointer for the OSX Server. Make sure its resolving correctly first using the relevant tools first then add the IP address of the Windows Server in the network preferences pane on your OSX Server. Thereafter you should be able to promote from Standalone to Open Directory Master without too many problems.
    If the Windows Server is using .local as its FQDN then it could scupper any chances you have of providing OSX LDAP services to your mac clients. It can work with .local, its just better if its not used.
    Hope this helps – Tony

  • Getting rid of Dos Window during "java" call

    Hi All
    I am trying to execute a batch file in windows which internally calls a "java" class file. while executing the class file the batch file launches a dos window in the backgroud..can anyone please tell me how to get rid of that dos window
    Thanks in Advance.
    Regards
    Kiran.R

    Instead of using java command in your batch file, change it to use javaw instead.
    V.V.

  • Not getting outputs from JavaScript Patch in QC2

    The JavaScript Patch no longer generates outputs from outputs[n]. The outputting of data just stopped.
    An example output generator (no other instructions in the JavaScript patch):
    outputs[0] = "string";
    was sent to an Image With String patch and then to a Billboard patch (the only existing patches). No text appeared in the viewer. When in Editor, the cursor placed over Output #0 shows only:
    Type Virtual
    with no value. The input string into Image With String shows "".
    When disconnecting the JavaScript patch from the Image With String patch and I entered "help", the text help appeared in the viewer.
    I reinstalled Quartz Composer and there was no change. Anyone have any idea what is going on?

    What I've learned: the Tascam 122L has known issues when working with Leopard. Back in the store, I plugged another external card (Presonus Audiobox USB), which immediately worked with the Mac as though they were friends since birth.
    I am rapidly warming to Mainstage.

  • Getting output from an OS command from an ABAP program

    Hi Folks!
    I have a requirement, is it possible to call an operating system command, and also get its output back to the ABAP program that has called it?
    For example, from an ABAP program calling the "dir" command from Windows and getting back (as a string) the directory listing to the ABAP program?
    Thanx in advance!
    Juan.

    This is will help you
    << Moderator message - links removed >>
    Please do not post a list of links. This simply encourages laziness. The OP could have found these with a little work.
    Edited by: Rob Burbank on Dec 13, 2010 9:19 AM

  • Getting output from a C programme

    Hi
    I am trying to execute a C programme (.o file) on Solaris and get its output .
    The C programme is a simple function which returns 0 or more then zero after executing some logic .
    I tried to use Runtime.exec() method but was not able to get any out put from the function , where as I did same in a perl script and was able to get the output .
    I have even tried to get error stream , input stream but I always get -1 as a return value .
    Following is my program
    Runtime rt = Runtime.getRuntime();
    String[] arg =new String[]{"program","arg1","arg2"};
    Process p =rt.exec(arg);
    BufferedInputStream buf = new     BufferedInputStream(p.getErrorStream());
    int data=buf.read();
    System.out.println("date is "+data);
    BufferedInputStream buf1 = new     BufferedInputStream(p.getInputStream());
         while((data=buf1.read())!= -1)
              System.out.println("data input is "+data);
    arg1 and arg2 are 2 arguments that the program needs . It always returns a value with might be 0 or non zero.
    I know I can try to use JNI , but i beleive using Process is a simple solution (if it works)
    Thanks

    .o files are usually no executables but object files. They need to be linked (with an object including the main funtion) to yield an executable.
    Shared objects are usually called *.so.

  • JNI: Reading Java output from console window

    Hi!
    Sorry if this is wrong place to put this topic, but I didn't know where to put it, so now it's here.
    I'm trying to make a launcher program with C++ which would start my java program. I'm using "env->CallStaticVoidMethod (romexisClass, mid, args);" and it works perfectly. But I'd like to read the text which my java program outputs to the console window and save it into a text file. Is this possible and how? It looks like I stdout etc. won't work.
    Or as other option I could use some Java Exe Wrapper, but I haven't found any which would allow passing arguments to the main() without -D option and I need to be able to read those arguments from a .ini-file. It should be a subtitute for the following command "java -Xss$var1k -Xms$var2m -classpath $var3 test.program host=$var4" in which I'd read $vars from a .ini-file.
    Thx,
    Lassi

    Maybe this will do the job:
    http://cboard.cprogramming.com/archive/index.php/t-86580.html

  • Downloaded Microsoft Office 365.  Wanted to use files originally done on Windows Word to my Ipad word app.  How do I get documents from a Windows source--even through someting like dropbox--into my i pad so I can work on them?

    How can I use document such as word or excell docs from my home windows based computer  in my office 364 ipad word or excell app that I downloaded for my ipad...   any suggestions out there?.

    I presume you have already downloaded the free M.S. office apps to use with your 365 subscription?   (Even if you haven't there are several other apps that will read these as well - )
    You can get the documents onto your pad several different ways.
    1. easiest for a single document is to simply e mail to your self.  In mail, tap the attachement once to cause it to down load.  then touch and hold the attachment until the 'open in ' box pops up, and choose the app you want to se.  The document will be saved with that app.
    for a loy of docs, it is easier to use the sharing system in I tunes, at the very bottom of the app tab.  Drag and drop the docs you want to move back and forth.
    Or use the clound.  Dropbox works fine.  Get the app in the store.
    To send them back out - reverse the process.

  • Getting output from my MBP to LCD TV

    Read any postings in this forum but could not find an answer. I have Apple's mini displayport, a DVi to HDMI cable and the appropriate audio cables.
    After connecting the MBP to the LCD TV I can see the desktop on the TV**. However when I closed the lid the TV goes black. With the lid open I run front row and it work on the MBP screen and on the TV I only get the same desktop image**
    What am I doing wrong?
    ** By the way the desktop picture in my MBP doesn't show. What it shows on the TV is the apple desktop purple "galaxy" image. Interesting!

    eew and Network 23,
    Thanks for adding to my post. It is very clear now. One of the problems I had is that I didn't realize that in System Preference>Displays, the menu changes a bit if you have the monitor connected or not.
    Two more questions,
    1) Based on your suggestions I prefer the extended desktop mode to preserve higher output resolution. I guess that when you have Mirroring off, it automatically means that you have the Extended Desktop option on, right?
    2) I cannot get the whole thing to work when I close my MBP. The TV goes black. I have an external mouse and keyboard (both bluetooh). I played with the "Arrangement" setting but nothing. What am I doing wrong.
    Thanks in advance.

Maybe you are looking for

  • ISE 1.2 and load balancing...

    I'm looking into configuring load balancing behind F5's. I know this can be done and have read the documentation on what is required. I still have a couple of questions about it: 1. When you load balance the RADIUS traffic do you have to create separ

  • Problem while opening ai cc

    hi guys I'm facing a problem when opening the ai cc on my laptop and the problem is that the ai shuts down immediately while opening it for some informations : I use windows 8.1 , and my laptop requirements are good enough to open the ai cc and thx

  • Slow "rearrange icon" feature on 4.2.1?

    Hello all I've already posted my issue inside one of the threads, but no one seems reacted on it. So I want to post it as a new thread. I've upgraded my iPhone 3GS from 4.1 to 4.2.1. No needs to say that we all missed new text tones But I've discover

  • TS1702 I have a song on my purchased list, that I didn't order. How do I let them know

    There is a song on purchased list, I've never heard of, or artist either. What can I do?

  • HT201401 iPhone 5 touch doesn't respond when fully charged

    Hello, I have iPhone 5 and there's a problem that the screen touch doesn't work properly when it's fully charged so I have to disconnect it from the charger so the touch will respond. Do you know why does it happend? Thanks