سؤال

I need to create a dir when i deploy my web-application. This dir will contain the profilepics of all users.

code:

public class ImageBootstrapper {

    public static void initialise(ServletContextEvent sce) {

        boolean mkDir = new File(sce.getServletContext().getRealPath("webapps").replace('\\','/') + "/profilePictures").mkdir();

    }

}
  • result: The creation of the dir ("profilePictures") failed.. path he uses: C:/apache-tomcat-7.0.6/webapps/spring-1/webapps/profilePictures

  • What i need: Creation of the dir ("profilePictures") at this path -> C:/apache-tomcat-7.0.6/webapps/spring-1/profilePictures

  • spring-1 is the application context

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top