| Author |
createNewFile() on linux hosting
|
Danilo Cosenza
Greenhorn
Joined: Feb 16, 2009
Posts: 4
|
|
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
Joined: Jan 10, 2002
Posts: 56185
|
|
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.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56185
|
|
|
"dani dani", please check your private messages for an important administrative matter.
|
 |
Danilo Cosenza
Greenhorn
Joined: Feb 16, 2009
Posts: 4
|
|
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
Joined: May 10, 2008
Posts: 139
|
|
|
If permission is not an issue print your fileName value in your log so that you can find the cause of the issue.
|
“Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”<br>
-Martin Fowler
|
 |
Danilo Cosenza
Greenhorn
Joined: Feb 16, 2009
Posts: 4
|
|
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
Joined: Feb 16, 2009
Posts: 4
|
|
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.
|
 |
 |
|
|
subject: createNewFile() on linux hosting
|
|
|