Java - getResourceAsStream returning null

March 23, 2016

Problem:

ProcessTest.class.getResourceAsStream(“H2/ddl/spring_batch/schema-drop.sql”);

Solution:

Check that the folder (““H2/ddl/spring_batch”) is part of the project classpath

in eclipse:

  • Right click on project
  • Click “Build Path”
  • Click “Configure Build Path…”
  • Select “Java Build Path”
  • Edit “Source” accordingly