[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Cannot open XML-File



Hello I have a problem with a simple operation.
I cannot open a XML-File!!!

This code:

public class Task3
{
 public static void main(String[] args) throws IOException
 {
  int laenge = 0;
   try{
   laenge = args[0].length();
   } catch (ArrayIndexOutOfBoundsException e){
   System.out.println("Usage: java Task3 <file> ");
   System.exit(0);}
   if(laenge > 1)
   {
    File fil = new File(args[0]);
    Parser par = new Parser(fil);
   }
  }
}

// calls this Object:

class Parser
{
 FileReader file1;
 public Parser(File f, Vector v)
 {
  try {
   file1 = new FileReader(f);
   }catch (FileNotFoundException e){
     System.out.println("File access error");
     System.out.println(e.toString());
     }
 ............
  }
}

With this code it is imposible to open any file with a .xml - suffix. I can 
but any kind of ascii-file. Accept for the case, if I call the file with its 
full path. But how is this possible? Can anybody help me?

Gruss Christian


-- 
Christian Stalp                 Wiesbaden / Germany
christian@stalp.de             ICQ 23091256
  -----------------www.stalp.de-----------------------



Reply to: