My java program has a reference to one of the text file. I have added the resource folder to build path, but still I'm not able to access the file in my program.
package first;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
public class First {
public static void main(String[] args) {
InputStream inputStream =
First.class.getResourceAsStream("message.properties");
if (inputStream == null)
{
System.out.println("IO stream is null");
return;
}
String result = null;
try {
result = inputStreamToString(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(result);
}
output
IO Stream is null