Good afternoon, I can not understand why I stopped loading the resource I work in eclipse, the composition of the project and the location of the file did not change it in the resources package
but suddenly it became an error.
Java.lang.NullPointerException in thread "java.io.DataInputStream.read (DataInputStream.java:100) at com4j_example.Main.main (Main.java:68)
I use this design for download.
InputStream in = Main.class.getResourceAsStream("date.txt"); System.out.println(in); DataInputStream din = new DataInputStream(in); FileOutputStream outF = new FileOutputStream("C://Users/Desktop/resources/date.txt//"); byte[] buffer = new byte[1024]; int count = 0; while ((count=din.read(buffer)) != -1){ outF.write(buffer,0,count); } outF.flush(); outF.close(); 