java - Creating dir on deploy with a bootstrap -


i need create dir when deploy web-application. dir contain profilepics of users.

code:

public class imagebootstrapper {      public static void initialise(servletcontextevent sce) {          boolean mkdir = new file(sce.getservletcontext().getrealpath("webapps").replace('\\','/') + "/profilepictures").mkdir();      }  } 
  • result: creation of dir ("profilepictures") failed.. path uses: c:/apache-tomcat-7.0.6/webapps/spring-1/webapps/profilepictures

  • what need: creation of dir ("profilepictures") @ path -> c:/apache-tomcat-7.0.6/webapps/spring-1/profilepictures

  • spring-1 application context

you can this:

boolean mkdir = new file(     sce.getservletcontext().getrealpath("/profilepictures")).mkdir();  

Comments

Popular posts from this blog

Delphi Wmi Query on a Remote Machine -