java - NullPointerException using getResource -
i'm trying create application recognize faces, following this tutorial. however, whenever run code below, error: exception in thread "main" java.lang.nullpointerexception
class detectfacedemo { public void run () { cascadeclassifier facedetector = new cascadeclassifier(getclass() .getresource("/lbpcascade_frontalface.xml").getpath()); } }
am supposed copy xml file directory?
thanks!
from comment, think put main/resources
in wrong directory (and forgot src
part of tree).
from tutorial, should have following structure: src/main/java/<java packages or classes>
you have src
folder there. create main
directory in src
, , resources
directory in main
. put xml file in resources
directory , should go.
Comments
Post a Comment