Java Data Type Tutorial - Java SecurityManager .checkLink (String lib)








Syntax

SecurityManager.checkLink(String lib) has the following syntax.

public void checkLink(String lib)

Example

In the following code shows how to use SecurityManager.checkLink(String lib) method.

//w w  w .  j av  a2  s .c om
public class Main {

   public static void main(String[] args) {
      System.setProperty("java.security.policy", "file:/C:/java.policy");

      SecurityManager sm = new SecurityManager();

      System.setSecurityManager(sm);

      sm.checkLink("JDBC");

      System.out.println("Allowed!");
   }
}