saurabh panwar

Greenhorn
+ Follow
since Feb 19, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by saurabh panwar

i have a check box on one page and combo box on another. When i click on a check box the value should be shown in the combo box.
i don't want to use the text field which is hidden.!!
thank u!!
19 years ago
try using vectors instead of arrays
20 years ago
thanks matt...for carin' to reply...but the prob still persists!!..well i tried something like this.
the output of my dir command is too large and ,may be that's why i 'm not gettin' the output....so i tried to print a large output stored in a text file by my java program(dos command "TYPE") AND TO MU surprise i could only type the file on the dos console when the size of the file was small. I could not type a large file!!!
20 years ago
import java.io.*;
//import java.lang.*;
//import java.util.*;
//import java.math.*;
//import java.util.*;
public class toyshell{

public static void main(String args[])
{
try{
toyshell toy = new toyshell();
String command ="dir";
String commands[]= new String[3];

//if(command.length()==0)
//{
//System.out.println("bad command");

//}
//else
//{

//System.out.println(command);
//}



if (command.equalsIgnoreCase("dir"))
{
System.out.println("command dir");

commands[0]="command.com";
commands[1]="/c";
commands[2]="dir";

Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(commands);


BufferedReader reader = new BufferedReader(new InputStreamReader(new DataInputStream( new BufferedInputStream(process.getInputStream()))));
String lineRead =null;

while( (lineRead = reader.readLine() ) != null)
{
System.out.println("hello");
String abc;
abc=lineRead;
//System.out.println(lineRead);
System.out.println(abc);

}

int done = process.waitFor();
System.out.println(done);


process.destroy();

}





}catch(Exception e){System.out.println(e);}
}
}

20 years ago
I've a simple program which runs the Dos "dir" command through java. I can See the output in my java text area but when i run this program on the dos prompt it doesn't show anythin and i have to Cntrl-Alt-Del the programe.
My code isimport java.io.*;

public class toyshell2{
public static void main(String args[])
{
try{
toyshell2 toy = new toyshell2();
toy.init();
}catch(Exception e){
System.out.println(e);
}
}
public void init() throws Exception{
String commands[]= new String[3];
commands[0]="command.com";
commands[1]="/c";
commands[2]="dir";
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(commands);
CheckStream csin = new CheckStream(process.getInputStream());
csin.run();
String line;
int done = process.waitFor();
System.out.println(runtime.freeMemory());

process.destroy();
}
class CheckStream{
BufferedReader br;
String lineread = "";
String lines = "";
String str="";
boolean erroroccured;
CheckStream(InputStream is){
try{
this.br = new BufferedReader(new InputStreamReader(is));
}
catch(Exception e){
System.out.println(e.getMessage());
}

}
/** Reads the input stream and displays anything returned.
*/
public void run(){
try{
while ((lineread = br.readLine()) != null){
System.out.println(lineread);
}
}
catch(Exception e){
System.out.println(e.getMessage());
}
}
}

}
20 years ago