KazekageGaara's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
64 (0.06 per day)
Joined:
09-June 10
Profile Views:
941
Last Active:
User is offline Jul 08 2011 12:41 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   KazekageGaara has not set their status

Posts I've Made

  1. In Topic: store output from a subprocess

    Posted 4 Jul 2011

    I modified it to:

    
    		try
    		{
    		String command = "cmd /c start javap java.lang.String"; 
                    Process process = Runtime.getRuntime().exec(command);
    		StringBuilder s=new StringBuilder();
    		StringBuilder t=new StringBuilder();
    		IOUtils.collectProcessStreams(process,s,t);
    		System.out.println(s.toString());
    		System.out.println(t.toString());
    		}catch(Exception e)
    		{
    			System.out.println(e);
    		}
    
    


    and all I get are two blank lines after I run the program :(
  2. In Topic: store output from a subprocess

    Posted 4 Jul 2011

    although it creates the write.txt file,it did that before also. But the write.txt file is blank,as it was before.And the program keeps throwing a NullPointerException.
    and also,in the corrections that you have made,at line 15,we can't re-declare temp,can we? Because we have already done that. And I was using
     temp = br.readLine(); 
    
    so why do it again?
  3. In Topic: store output from a subprocess

    Posted 4 Jul 2011

    still doesn't work mate..

    try
    {
    	String command = "cmd /c start javap java.lang.String"; 
            Process process = Runtime.getRuntime().exec(command);
    	StringBuilder s=new StringBuilder();
    	StringBuilder t=new StringBuilder();
    	IOUtils.collectProcessStreams(process,s,t);
    }catch(Exception e)
    {
    	System.out.println(e);
    }
    
    


    the command prompt opens,and the command is executed,and then that window closes automatically.
  4. In Topic: store output from a subprocess

    Posted 4 Jul 2011

    so like:

    Process process = Runtime.getRuntime().exec("cmd /c start javap java.lang.String");
    IOUtils.collectProcessStreams(process,_____,____);
    
    


    what do I pass for the other two parameters?
  5. In Topic: store output from a subprocess

    Posted 4 Jul 2011

    @immeraufdemhund
    from what I read on that link,I tried something on those grounds,and even that didn't work. Here's a piece of code on what I tried:

    public static void main(String args[])
    {
            try
    	{
    		Runtime RT = Runtime.getRuntime();
    		String command = "cmd /c start javap java.lang.String"; 
    		File file = new File("write.txt");
    		Writer output = new BufferedWriter(new FileWriter(file));
                    BufferedReader br = new(BufferedReader(newInputStreamReader(RT.exec(command).getInputStream()));
    		String temp = br.readLine();
    		while(!temp.equals(null))
    		{
    			output.write(temp);
    			output.close();
    			temp = br.readLine();
    		}
    		RT.exec("exit");
    	}
    	catch(Exception e)
    	{
    		System.out.println(e);
    	}
    }
    
    





    @g00se
    couldn't understand much on that page. If you could just explain a bit? :)

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

KazekageGaara hasn't added any friends yet.

Comments

KazekageGaara has no profile comments yet. Why not say hello?