Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need help with file input/output from servlet

Posted on 2006-11-05
2
Medium Priority
?
261 Views
Last Modified: 2013-11-24
I have a servlet that I'm trying to read from a file and write it back out with new objects added to it, but the the servlet can not find the file.  It's running on Tomcat so i'm almost sure it has to do with the catalina.policy file.

I believe that i need to do something similar to the following but i'm not sure if it is correct and if it is where do i need to place it in the catalina.policy file.  Also, would i need to remove anything from the catalina.policy file?

grant codeBase "file:${catalina.home}/webapps/ROOT/conf" {
      permission java.io.FilePermission "${catalina.home}/webapps/ROOT/conf  myfile.txt", "read,write,delete";
};

Or do you guys have any other ideas as to why it may not be able to find the file?
0
Comment
Question by:tbboyett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 17879271
whats the error?
more likely that it can't find the file than a security exception. Why are u using a security manager?

If its not finding the file try using the ServlketContext getRealPath() method toi get the file path
0
 
LVL 5

Author Comment

by:tbboyett
ID: 17884648
as usual you are correct objects, thanks once again :D
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
A solution for Fortify Path Manipulation.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question