java - File not found exception while reading the from jar in spring? -
i working on spring ,i want read file name jar file,but getting filenotfoundexception
. 1 me, please check code below.
classpathresource classpathresource = new classpathresource("test.txt"); system.out.println(classpathresource.getpath()); system.out.println(classpathresource.geturi()); system.out.println(classpathresource.geturl().getpath()); system.out.println(classpathresource.geturi().getpath());
but when wrote below
system.out.println(classpathresource.getfile().getcanonicalpath()); system.out.println(classpathresource.getfile().getpath());
the above 2 lines throwing exception, when working normal java program, working great.
Comments
Post a Comment