java - Static method file path -
this question has answer here:
how path of file in same package class?
this doesn't work.
public static void saveallmockdata() throws exception { inputstream inputstream = getclass().getclassloader().getresourceasstream("mockdata.json"); }
you can use
inputstream = yourclassname.class.getresourceasstream("mockdata.json"");
or can specify package path
getclass() .getresourceasstream("/abc/efg/mockdata.json");
Comments
Post a Comment