Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/08/2008, 17:44
lucashard
 
Fecha de Ingreso: diciembre-2007
Mensajes: 41
Antigüedad: 17 años, 3 meses
Puntos: 0
Error java.io.BufferedInputStream@1fb8ee3

porq' me tira esta ecepcion???

codigo:

import java.lang.Runtime.*;
import java.lang.Process;
import java.util.Scanner;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.*;
public class conectividad {

public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub

Process n1;
Process n2;
String hola="Respuesta desde 192.168.1.1: bytes=32 tiempo<1m TTL=64";
Runtime runtime = Runtime.getRuntime();
String path = "C://batch.bat";


FileWriter archivoescritura = new FileWriter("c:\\conectividad.txt");
PrintWriter archivoSalida = new PrintWriter(archivoescritura);

n2=runtime.exec(path);

archivoSalida.println(n2.getInputStream());

archivoSalida.close();


File archivo1=new File("c:\\conectividad.txt");
Scanner archivolectura = new Scanner(archivo1);
while (archivolectura.hasNext())
{String linea = archivolectura.nextLine();

System.out.println(linea);

if (linea==hola)
{System.out.println("Hay conectividad");}
else
{System.out.println("No hay conectividad");}

}

}

}