Results 1 to 2 of 2

Thread: Whats wrong with this??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    ca, usa
    Posts
    91
    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.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    ca, usa
    Posts
    91
    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.
    [email protected]
    If its as simple as it sounds I guess I am not basic enough.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width