try { File file = new File("C:\\LSE0910\\Log\\log"); if(file.exists()){ System.out.println("file exists") ; } else { System.out.println("file no exists"); // тут то и надо создать путь C:\LSE0910\\Log\ } FileOutputStream fileOut = new FileOutputStream("C:\\LSE0910\\Log\\log"); wb.write(fileOut); fileOut.close(); } catch (IOException ex) { System.out.println(ex); }