Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileOutputStream

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the FileOutputStream to print a uploaded html file to a file on my machine. I must manipulate the data before I write it to the disk. I do use orielly's classes, but I have another problem, when I use:
FileOutputStream fout = new FileOutputStream(theFile);
The file prints in my tomcat bin directory. (I am geeting this file from a servlet using tomcat.
I am tryign to get it to print in a folder in my root directory but I cant. I tried:
fout = new FileOutputStream( "c:\\portal\\temp\\ "+ theFile );
fout = new FileOutputStream( "\\portal\\temp\\ "+ theFile );
neither works but the directory is there.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly what happens why you try? Particularly, what type of exception is thrown?
Bill
 
marijana grabovac
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Try this :
FileOutputStream fout = new FileOutputStream("c:/something/something/somefile.txt");
I just tried it and it worked for me!
 
Huang Qingyan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should create a folder in c:\\portal\\temp manually. After that you invoke the fileoutputstream method. Try it......
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic