This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Directory creation in the server

Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
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?

thanks in advanced.
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

    Bookmark Topic Watch Topic
  • New Topic