Signing Code and Granting It Permissions [Tools] |
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 you place it in theC:\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 the purpose of this trail, put the data file in a directory other than the directory containing theCount
application. The examples of this lesson assume you put the data file in theC:\TestData
directory. The next lesson will show 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.
Signing Code and Granting It Permissions [Tools] |