File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes my program  can not write in own file with tomcat5.32 + cpanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "my program  can not write in own file with tomcat5.32 + cpanel " Watch "my program  can not write in own file with tomcat5.32 + cpanel " New topic
Author

my program can not write in own file with tomcat5.32 + cpanel

amir taghvayi
Ranch Hand

Joined: Sep 16, 2011
Posts: 54
hi
i use tomcat5.32 + cpanel .

my code is :
<%
Properties p = new Properties() ;
String path = application.getRealPath("");
path +="/WEB-INF/classes/pack2/cookie.properties" ;
p.load(new FileInputStream(path));
p.setProperty("amir", "morteza") ;
p.store(new FileOutputStream(path), "this is a test");

%>

when requested get this error :

java.io.FileNotFoundException: /home/domainname/public_html/ROOT/WEB-INF/classes/pack2/cookie.properties (Permission denied)
java.io.FileInputStream.open(Native Method)
java.io.FileInputStream.<init>(FileInputStream.java:106)
java.io.FileInputStream.<init>(FileInputStream.java:66)
org.apache.jsp.newjsp_jsp._jspService(newjsp_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

please help me !!!

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

YOu do not have permission to write into that folder. Besides, do you really want to to do this? Think of what will happen when it comes time to redeploy the application.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
amir taghvayi
Ranch Hand

Joined: Sep 16, 2011
Posts: 54
hi Bear Bibeault

the perms is 0644 but my program can not write in own files and it is not any error when deploy program .
help me !
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: my program can not write in own file with tomcat5.32 + cpanel