The policy file
If a security manager is installed, then the code must be given proper
permissions.
Listing 6.8 (policy.txt)
grant {
permission java.net.SocketPermission
"localhost", "accept, connect, listen, resolve";
};
A java.net.SocketPermission represents
access to a network via sockets. A SocketPermission
consists of a host specification and a set of "actions" specifying ways
to connect to that host.
You can use policytool to create policy files.
|
The security manager
throws an AccessException to indicate that the caller does not
have permission to perform the action requested by the method
call.
|
Preparing for deployment
I am assuming that you have successfully compiled all the files.
Create two directories:
Server
Client
Copy the following files to the "Server"
directory:
- InfoInterface.class
- InfoServerImpl.class
- InfoServerImpl_Skel.class
- InfoServerImpl_Stub.class
The "Server" directory includes all
the files that are needed to run the server and those class files that
will be dynamically loaded. You will deploy the above files on the server
computer.
Copy the following files to the "Client"
directory:
- InfoClient.class
- InfoInterface.class
- Policy.txt
You will deploy these files on the client computer.
|
You must copy
the class file for the remote interface (such as InfoInterface).
The client does not download these classes dynamically.
|
|