Cannot Read File From Applet
I have read text files from applications numorous times but when I try to do that in applets it says access denied. I tried using scanner and DataInputStream and I had the same problem both times. Heres My code...
publicclass Readextends Applet
{
publicvoid init()
{
readFile();
}
publicvoid readFile()
{
String path="C:/file.txt";
try
{
DataInputStream in =new DataInputStream(new FileInputStream(path));
while (in.readLine()!=null)//Loop Till It Gets Through All The Lines
{
String readInput = in.readLine();
StringTokenizer tok =new StringTokenizer(readInput);
System.out.println(tok);
}
in.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
publicvoid paint(Graphics g)
{
g.drawString("Welcome to Java!!", 50, 60 );
}

