Ver Mensaje Individual
  #5 (permalink)  
Antiguo 24/01/2010, 21:37
megajandro
(Desactivado)
 
Fecha de Ingreso: diciembre-2008
Ubicación: por ahi!!!
Mensajes: 113
Antigüedad: 15 años, 4 meses
Puntos: 1
Respuesta: Acceso denegado al crear fichero

proba con algo asi mejor.


public class CreaArchivoTest {

@Test
public void test(){
String path = System.getProperty("java.io.tmpdir") + File.separator + "Fichero.txt";
CrearUnFichero crearUnFichero = new CrearUnFichero();
crearUnFichero.creaArchivo(path);
}

}


public class CrearUnFichero {

public boolean creaArchivo(String url){
File fichero = new File(url);

try {

if (fichero.createNewFile()){
System.out.println("El fichero se ha creado correctamente");
return true;
}
else
System.out.println("No ha podido ser creado el fichero");
} catch (IOException ioe) {
ioe.printStackTrace();
return false;
}
return false;
}
}