• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

createNewFile() on linux hosting

 
Danilo Cosenza
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice to meet you.
I've a strange problem while creating a simple 'hello.txt' in a jsp page.
Here the code:

....

....

I obtain no errors but 'hello.txt' doesn't exists on my linux remote server (Tomcat 6.0 - container).

Any suggestion?
Thanks a lot

Dany
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64961
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ignoring the fact that you shouldn't be putting Java code in a JSP page...

"hello.txt" is a relative file path which makes no sense in the context of a web app.

Where in the file hierarchy do you want it to go? For example, "/hello.txt" will place it at the root of the web app context.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64961
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"dani dani", please check your private messages for an important administrative matter.
 
Danilo Cosenza
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Ignoring the fact that you shouldn't be putting Java code in a JSP page...

"hello.txt" is a relative file path which makes no sense in the context of a web app.

Where in the file hierarchy do you want it to go? For example, "/hello.txt" will place it at the root of the web app context.


Thanks Bear.
Doesn't work too (tested some hours ago).
It's possible i've not a permission to write files in the root of my webapp?
When i tested this function on my locale pc (windows - tomcat 6.0), all works fine.
 
Venkat Sadasivam
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If permission is not an issue print your fileName value in your log so that you can find the cause of the issue.
 
Danilo Cosenza
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venkat Sadasivam wrote:If permission is not an issue print your fileName value in your log so that you can find the cause of the issue.


Thanks for reply.
I'm not able to do that.
I've tried to store an exel file on server using Apache Poi.




test.xls doesn't appear in /var/www/html but no errors occurred.

 
Danilo Cosenza
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOLVED

By clicking on html folder on server, i'v changed the permission to write on it.
All works fine and an excel file is visible.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic