• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is the method to get the current directory(please read)

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
friends
This is my first post in this category though i have been a regular in some other parts of the ranch
I am facing a unique problem first of all i am using Tomcat with JSP. What i want to do is accept a folder name from the user and create a folder by that name. I have written a bean for this which goes.

my problem is that this code is working fine on my local machine but when i use it on the server it is creating a folder in some unknown place. Suppose i have a folder "A" inside which i am placing my class file.
My questions:
1) Which of the methods will return me the String "root:\A\"
because most of the methods are returning me "root:\A\directoryname" or "directoryname"
where directoryname = the String that i am passing in the file object f (c the code)so that i can pass it in the first argument of f and make a directory in the current directory
2)How do i create a directory in any place i want. Eg suppose i have my class file placed in c:/tomcat/webapps/classes and i want to create the directory in c:/tomcat/webapps/application/upload
Any ideas will be highly appritiated
URGENT
Amit
[This message has been edited by Amit Roy (edited March 20, 2001).]
[This message has been edited by Amit Roy (edited March 20, 2001).]
[This message has been edited by Amit Roy (edited March 20, 2001).]
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ServletContext.getRealPath("relativePath\fileName") will give us the real path of the file starting from root. If the server machine is windows, it will give out c:\tomcat\....\whateverdir\fileName
regds
maha anna
 
I knew that guy would be trouble! Thanks tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic