Question: In this question, you develop a program that displays system properties, using a security manager and an associated security policy file. The program, called SystemProperties,

 In this question, you develop a program that displays system properties,

In this question, you develop a program that displays system properties, using a security manager and an associated security policy file.

The program, called SystemProperties, programmatically sets the policy file (which is in the working directory), installs a security manager, accepts user input of system property names, and displays the corresponding system property values. If the security manager forbids the reading of a system property, the program catches and displays the exception, and continues accepting user input. When the user enters an empty line (just press the Enter key), the program ends its execution.

The security policy file, called SystemProperties.policy, grants read access for system properties whose names begin with java..

Submit both the program and the policy file. This is a sample output of running the program.

In this question, you develop a program that displays system properties, using a security manager and an associated security policy file. The program, called SystemProperties, programmatically sets the policy file (which is in the working directory), installs a security manager, accepts user input of system property names, and displays the corresponding system property values. If the security manager forbids the reading of a system property, the program catches and displays the exception, and continues accepting user input. When the user enters an empty line (just press the Enter key), the program ends its execution. The security policy file, called SystemProperties.policy, grants read access for system properties whose names begin with java.. Submit both the program and the policy file. This is a sample output of running the program. > java a2. SystemProperties Enter a property name, or an empty line to quit java. home java. home: C:\java\java-13-openjdk java.version java.version: 13.0.2 java.err java.err: null user. home Error: access denied ("java.util.PropertyPermission" "user.home" "read") err Error: access denied ("java.util.PropertyPermission" "err" "read") (the user enters an empty line here)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!