1

I want to access my resource folder path which is inside the packaged WAR created by spring boot. I have looked this link, which is to access specific file at some location but I am looking for just the folder location.

With WAR file getRealPath() / getAbsolutePath() does not work, below is the snippet

String contextPath = event.getServletContext().getRealPath("/WEB-INF/scripts/views/"); 

One more scenario wherein I want to access ImageMagic tool which is packaged inside war at "WEB-INF/classes/ImageMagick-6.6.1-5" location but it is not accessed by the im4java library. Providing any drive location like "C:/ImageMagick-6.6.1-5" will work.

String bindir = URLDecoder.decode(getClass().getClassLoader().getResource("ImageMagick-6.6.1-5").getPath());

Is there any workaround to access the location of directory inside WAR.

Ravi
  • 195
  • 3
  • 15

0 Answers0