• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Directory creation in the server

 
vikas malviya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all

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
1.
created a small application which create the directory of images.
the method uses for the getting the path is
.getServletContext().getRealPath("/")
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?

thanks in advanced.
 
Shashank Rudra
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic