• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to add to a application path??  RSS feed

 
J radolf
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
How do i create a folder under this path?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
Sachin Adat
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • 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
  • 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]
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!