• 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

how to add to a application path??

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String appPath=application.getRealPath("/");

this is the path am saving my files.

if i have a file whcih has to be saved to appPath+"SOMEFOLDER"
how do i do it??

 
J radolf
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do i create a folder under this path?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the API documentation of class java.io.File. It contains methods to create directories.
 
J radolf
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got the previous answer.

if i want to save my file in a location other then the path given by

which method can i use??

can anyone help?
 
J radolf
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
suppose i have my folder
under webapps/APPFOLDER/temp

now if i want to save it under temp folder... then which is the method used??

am able to save under APPFOLDER till now.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

january radolf wrote:suppose i have my folder under webapps/APPFOLDER/temp
now if i want to save it under temp folder... then which is the method used??
am able to save under APPFOLDER till now.



The method will be the same to create a file.
Just create a new file object with the directory you want to create in(in your case webapps/APPFOLDER/temp) and use it to create the file.
 
J radolf
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


this is my code i am able to load the files to /webapps/myprojectfolder..

but am not able to load it to /webapps/myprojectfolder/ThisFolder.

thanks in advance
[Edit]Add new lines to 1st line of quoted code so it will fit into the screen width. CR[/edit]
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm beginning to think this question is more difficult than we usually have here on beginners'. I shall move it.

And beware of writing very long lines particularly in code tags because they exceed the width of the screen.
I have edited your post for that reason.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic