is there a policy type file needed for JSP file privileges?

Discussion in 'Java' started by anikkar@gmail.com, Nov 7, 2005.

  1. Guest

    hi,

    I am just getting started with JSPs, and i am writing a few small
    utility files, and i am having trouble writing to a text file.

    my java file is as such:

    import java.io.*;

    public class Utils {

    public static final int EOF = -1;

    public static String writeFile(String file) {
    try {
    BufferedWriter out = new BufferedWriter(new FileWriter(file));
    out.write("This is a test");
    out.close();
    return "succes";

    }
    catch(Exception e) {
    return e.getMessage();
    }

    }
    }



    and my jsp:

    <%@ page import="java.util.Enumeration"%>
    <%@ page import="com.lambandtunafish.Utils"%>
    <html>
    <body>
    <B>Test</B><BR>
    <%
    out.println(Utils.writeFile("/home/content/b/u/d/budweiser/html/test/test.txt"));

    %>
    </body>
    </html>



    But when I run it, I get the following:

    access denied (java.io.FilePermission
    /home/content/b/u/d/budweiser/html/test/test.txt write)

    I have tried it both when the test.txt file exists, and does not exists
    (i.e. java creates the file). I do have read permission, as I have been
    able to read from the file.

    what I am having trouble with is setting the write permission

    I have tried contacting my hosting company, and as usual i got the
    simple response of: "make sure your permissions are set
    correctly"...which i'm not so sure on how to do that with java...any
    ideas..thanks!?
    , Nov 7, 2005
    #1
    1. Advertising

  2. Guest

    It may be related to the way your application server is configured. I
    know with websphere the default settings do not allow an application to
    write to the file system.
    , Nov 8, 2005
    #2
    1. Advertising

  3. Guest

    yea, that may be the case, if so, does that mean I am pretty much
    screwed if I want to do any File output?

    my provider is godaddy, and theier tomcat version is 5.0.27.
    , Nov 8, 2005
    #3
  4. Guest

    I'm not familiar with changing that setting for Tomcat but I'm sure it
    is possible. Whether your provider will allow you to change it is
    another matter
    , Nov 10, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Nassar

    Debugger privileges for ASP.NET

    Tony Nassar, Jan 26, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    1,704
    Tony Nassar
    Feb 12, 2004
  2. Shalini
    Replies:
    1
    Views:
    322
    Hernan de Lahitte
    Mar 5, 2004
  3. =?Utf-8?B?c2hlZmFsaQ==?=

    HTTPHandler to create, write file and account privileges

    =?Utf-8?B?c2hlZmFsaQ==?=, Dec 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    363
    =?Utf-8?B?c2hlZmFsaQ==?=
    Dec 2, 2004
  4. Replies:
    0
    Views:
    4,330
  5. Replies:
    5
    Views:
    460
Loading...

Share This Page