Previous | Next | Trail Map | Security in JDK 1.2  | Signing Code and Granting It Permissions

Download and Try the Sample Application

The application used by this lesson is supplied for you.

Create a file named Count.java on your local computer by either copying or downloading the Count.java source code. The examples in this lesson assume that you place it in the C:\Test directory.

Now compile and then run the Count application to see what it does. You need to specify (as an argument) the path name of a file to be read. You can download and use this sample file named data or any other file you like.


Important: For this lesson, put the data file in a directory other than the directory containing the Count application. The examples assume that you put the data file in the C:\TestData directory. Later in this lesson you will see how an application running under a security manager cannot read a file unless it has explicit permission to do so. However, an application can always read a file from the same directory (or a subdirectory); it does not need explicit permission.

A sample run is

    C:\Test>java Count C:\TestData\data
    Counted 65 chars.


Previous | Next | Trail Map | Security in JDK 1.2  | Signing Code and Granting It Permissions