I have tried using / instead of \\, but It doesn't work. Thanks anyway.
 
Any ideas? Perhaps is a Security problem with Tomcat or Axis2 that I must 
configure?


Date: Mon, 3 Mar 2008 18:31:22 +0800From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: 
Re: Read/Write file with absolute pathjanfry, getResource and 
getResourceAsStream dont work with physical files, those methods can be used if 
the files to be read are within the same jar file as the class that's calling 
itwhy dont you try using / instead of \\? though they both are the same.if it 
says file not found then the file's not there
On Mon, Mar 3, 2008 at 6:28 PM, Javier V <[EMAIL PROTECTED]> wrote:

Hi. This must be a newbie question but I haven't found how to resolve it. I'm 
using Windows, Tomcat 5.5 and Axis 1.3. I want to read (and write) files that 
are in directories not included in the classpath. The following method to read 
a file and returning the contents into a String:     public static String 
readFile2String(String file) throws Exception {        String content = null;   
     FileInputStream fis = null;        try {            fis = new 
FileInputStream(file);            int x = fis.available();            byte b[] 
= new byte[x];            fis.read(b);            content = new String(b);      
  } finally {            if (fis != null) {                fis.close();         
   }        }        return content;    } works with these calling lines in a 
standalone program:     public static void main(String[] args) throws Exception 
{        System.out.println("FILE CONTENTS=" + 
readFile2String("W:\\tests\\data\\fich00.dat"));    }However, when executed     
readFile2String("W:\\tests\\data\\fich00.dat") within the web service, it 
generates "java.io.FileNotFoundException". Must I configure anything in Tomcat 
and/or Axis2 to access any file or directory? NOTE: I do NOT want to include 
those files into "lib" or "classes" directory, and how the files are notin the 
classpath, getClassLoader().getResource() o getResourceAsStream I know doesn't 
work. Thanks in advance, Janfry
 

Sigue de cerca las últimas tendencias y lo que más rompe MSN Vídeo-- Website: 
http://chitgoks.freehostia.comJava Casino Games: http://chitgoks.tripod.comMy 
Blogs: http://chitgoks.blogspot.comhttp://wuhtevah.blogspot.com 
_________________________________________________________________
Tecnología, moda, motor, viajes,…suscríbete a nuestros boletines para estar 
siempre a la última
http://newsletters.msn.com/hm/maintenanceeses.asp?L=ES&C=ES&P=WCMaintenance&Brand=WL&RU=http%3a%2f%2fmail.live.com

Reply via email to