Java Class getProtectionDomain() MethodThe getProtectionDomain() method of java Class class returns the ProtectionDomain of this class. This method internally calls the checkPermission() method of the Security Manager (installed with this class) is called with a RuntimePermission to check if it is okay to get the protection domain. SyntaxParameterNA ReturnsProtectionDomain ThrowsSecurityException. Example 1Test it NowOutput: Class = ClassgetProtectionDomainExample1 ProtectionDomain (file:/C:/Users/Suman/Documents/NetBeansProjects/calendar/build/classes/ <no signer certificates>) sun.misc.Launcher$AppClassLoader@2a139a55 <no principals> java.security.Permissions@4e25154f ( ("java.io.FilePermission" "\C:\Users\Suman\Documents\NetBeansProjects\calendar\build\classes\-" "read") ("java.lang.RuntimePermission" "exitVM") ) Example 2Test it NowOutput: ProtectionDomain (file:/C:/Users/Suman/Documents/NetBeansProjects/calendar/build/classes/ <no signer certificates>) sun.misc.Launcher$AppClassLoader@2a139a55 <no principals> java.security.Permissions@4e25154f ( ("java.io.FilePermission" "\C:\Users\Suman\Documents\NetBeansProjects\calendar\build\classes\-" "read") ("java.lang.RuntimePermission" "exitVM") ) Next TopicJava Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India