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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -