Now that we’ve gone to the trouble of (Freelance web design)
Friday, April 27th, 2007Now that we’ve gone to the trouble of creating a policy file, let’s use it. You can tell the default security manager to use the policy file with another command-line option to the java interpreter: C:> java -Djava.security.manager - Djava.security.policy=EvilEmpire.policy EvilEmpire Connected! EvilEmpire can now make its socket connection because we have explicitly granted it permission with a policy file. The default security manager still protects us in other ways, however; EvilEmpire cannot write or read files on the disk except in the directory it came from; it cannot make connections to any other network addresses except the one we specified. Take a moment and bask in this warm fuzzy feeling. Later, in Chapter 20, you’ll see policytool again when we explain signed applets. In this chapter, codebases are identified by URLs, which isn’t the most secure option. Through tricky network shenanigans, a clever forger may be able to give you code that appears to be from somewhere it’s not. Crytpographically signed code is even more trustworthy; see Chapter 20 for the full details. 3.3 The Class Path The concept of a path should be familiar to anyone who has worked on a DOS or Unix platform. It’s an environment variable that provides an application with a list of places to look for some resource. The most common example is a path for executable programs. In a Unix shell, the PATH environment variable is a colon-separated list of directories that are searched, in order, when the user types the name of a command. The Java CLASSPATH environment variable, similarly, is a list of locations that can be searched for packages containing Java class files. Both the Java interpreter and the Java compiler use CLASSPATH when searching for packages and classes on the local host. A location on the class path can be a directory name or the name of a class archive file. Java supports archives of class files in its own Java archive ( JAR) format, and in the conventional ZIP format. JAR and ZIP are really the same format, but JAR archives include extra files that describe each archive’s contents. JAR files are created with the SDK’s jar utility; many tools for creating ZIP archives are publicly available. The archive format enables large groups of classes to be distributed in a single file; the Java interpreter automatically extracts individual class files from an archive, as needed. The precise means and format for setting the class path vary from system to system. On a Unix system, you set the CLASSPATH environment variable with a colon-separated list of directories and class archive files: CLASSPATH=/home/vicky/Java/classes:/home/josh/oldstuff/foo.zip:. On a Windows system, the CLASSPATH environment variable is set with a semicolon-separated list of directories and class archive files: set CLASSPATH=D:usersvickyJavaclasses;. The first example above, for Unix, specifies a class path with three locations: a directory in the user’s home, a ZIP file in another user’s directory, and the current directory, which is always specified with a dot (.). The last component of the class path, the current directory, is useful
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web design programs services