i wanted to make a directory in the server(Apache),i had already tested locally where i was succesfull,but application is not working after i uploaded the file in the server,the details are as follows
created a small application which create the directory of images.
the method uses for the getting the path is
now my question is does using this method can we get the path from the apache server and if not how can i found the path of mine file?
.getServletContext().getRealPath("/") gives you just a way to get the absolute path of your context. i.e. the root of your application. But after this you will have to append to it the relative location of your file to get the complete path. For say you are using Tomcat - you have your application myApp deployed on Tomcat. You have tomat installation directory as C:\Tomcat. You will see a directory with name myApp inside tomcat/webapps directory. .getServletContext().getRealPath("/") - will give you C:\Tomcat\webapps\myApp. Relative path will be where inside this directory you have placed your file. And we will have to add this to the context path to get the absolute path.