Java Class getProtectionDomain() MethodLast Updated : 17 Mar 2025 The 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 1Output:
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 2Output:
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 request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India