PDA

Click to See Complete Forum and Search --> : Whats wrong with this??


Dafly
Oct 29th, 2000, 09:31 PM
I keep getting an error saying exception: com.ms.security.SecurityExceptionEx[counterApp.init]cannot access file Vist.cnt

if you need to make a Vist.cnt file all it is is a text file with any numbers like 1495



import java.applet.Applet;
import java.awt.*;
import java.io.*;

public class counterApp extends Applet {

int Visits;
String HldVis;


public void init() {
HldVis = "";

try{
FileInputStream Fis = new
FileInputStream("Vist.cnt");
DataInputStream myInput =
new DataInputStream(Fis);

while (myInput.available() !=0)
{
HldVis = myInput.readLine();
String.valueOf(HldVis);
}
myInput.close();
}
catch (Exception e)
{
}

try{

FileOutputStream fos = new FileOutputStream("Vist.cnt");
PrintStream myOutput = new PrintStream(fos);

int Visits = Integer.parseInt(HldVis);
Visits++;
myOutput.print(Visits);
myOutput.close();
System.out.println("Hello");
//repaint();
}

catch (IOException e)
{
System.exit(1);
}
}


public void paint(Graphics g) {
g.setColor(Color.red);
g.drawString(String.valueOf(Visits), 50, 10);
}



}






Thanx,
Jeremy


If its as simple as it seems then I am not basic enough.

Dafly
Oct 30th, 2000, 07:52 PM
Yes you hit it right on the nose, I was reading a tut. and it said the same thing but since I want it to read/write server side, I was able to use diffrent code in order to read and write, cgi code to write, and new url code to read.


Thanx,
Jeremy


If its as simple as it sounds I guess I am not basic enough.