This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes how to create a file on server. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to create a file on server." Watch "how to create a file on server." New topic
Author

how to create a file on server.

satnam singh negi
Greenhorn

Joined: Aug 13, 2011
Posts: 25

Hi all,

please help me to create a file on server, i want to create a directory above the web-inf and then want to generate a file inside it.



I am trying this and i am able to go the place where i want to but, No file is getting generated.

Please suggest.


Thanks in Advance.
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
Hi Satnam,
How are you generating the file? Please put the code here.
satnam singh negi
Greenhorn

Joined: Aug 13, 2011
Posts: 25

bhanu chowdary wrote:Hi Satnam,
How are you generating the file? Please put the code here.






This should create a file in my workspace,in somefolder under webcontent.but not working.

any other approach will appreciable.

Thanks !!
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

I belive this does not works because "somefolder" does not exists or test.txt exists already.
Have a try:
satnam singh negi
Greenhorn

Joined: Aug 13, 2011
Posts: 25

Zandis Murāns wrote:I belive this does not works because "somefolder" does not exists or test.txt exists already.
Have a try:




That is a great help....and it says file already exists..but i can't find it in the folder. where it has been created already ?
Thanks
Zandis Murāns
Ranch Hand

Joined: Aug 18, 2009
Posts: 174

You are seeing full path to the file in that output message.
If you're not seeing such file in you'r file explorer, perhaps it's hidden or somehow invisible to the user. Copy full path of that file, run notepad or other you'r text editor and click open -> paste copied path -> return key press.
satnam singh negi
Greenhorn

Joined: Aug 13, 2011
Posts: 25

Zandis Murāns wrote:You are seeing full path to the file in that output message.
If you're not seeing such file in you'r file explorer, perhaps it's hidden or somehow invisible to the user. Copy full path of that file, run notepad or other you'r text editor and click open -> paste copied path -> return key press.




Absolutely , you are correct !! i did that thing and an notepad turns into a .txt file ,it show the name of file. but why it is happening like

that..what do i need to do if i want to create a file on my workspace, e.g like relative to web-inf or anywhere in workspace.


Please Suggest.

Thanks !!
 
 
subject: how to create a file on server.
 
Similar Threads
Directory Creation on FTP Server using Java Program
create a folder and choose that folder to save a newly created file
How to make a jar file ?
problem in creating xml
How to create Dynamic tree in Java Server Faces(please very urgent)