title: Class.forName() is not working with a particular class
body: <p>I am trying to load with java reflection a bunch of classes. Everything seems working fine (I am handling the exception if the class is not found). </p>
  
  <p>However there is a particular class that is raising another exception that is not thrown by call to the Class.forname() but by an internal method and so I cannot even catch it.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>try {
       URL url = Class.forName(qualifiednameOfTheClass);
  } catch (ClassNotFoundException ex) {
       // ok class not found can be handled
  } catch (Exception e){
       // catch every other exception just to try to get the strange exception
  }
  </code></pre>
  
  <p>So with this code everything is working, I am using it on lots of classes and it's working (sometimes it finds it sometimes it doesn't). </p>
  
  <p>However there is one case that is not working properly and I cannot understand why. If <code>qualifiednameOfTheClass = sun.security.krb5.SCDynamicStoreConfig</code> my code is raising an exception:</p>
  
  <blockquote>
    <p>Exception in thread "mythread-1" java.lang.UnsatisfiedLinkError: no
    osx in java.library.path  at
    java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)  at
    java.lang.Runtime.loadLibrary0(Runtime.java:849)  at
    java.lang.System.loadLibrary(System.java:1088)    at
    sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
      at
    sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
      at java.security.AccessController.doPrivileged(Native Method)   at
    sun.security.krb5.SCDynamicStoreConfig.(SCDynamicStoreConfig.java:39)
      at java.lang.Class.forName0(Native Method)  at
    java.lang.Class.forName(Class.java:190)   at
    com.myclass.getJARFromClassForName(JavaId.java:510)
      at com.myclass.getJARUrl(Id.java:550)   at
    com.myclass.collectInformation(Graph.java:366)
      at
    com.myclass.createNode(Graph.java:166)
      at com.myclass.Graph.(Graph.java:143)     at
    com.myclass2.run(myclass2.java:246)
      at java.lang.Thread.run(Thread.java:745)</p>
  </blockquote>
  
  <p>So as you can see in the error we have this strange exception that cannot be caught even with a generic catch like in my code and I cannot understand why it has been raised and what actually is this osx library (I am on linux)</p>
  
  <p>EDIT: The only thing that I found is this link <a href="http://www.straub.as/java/pocketapi/index7.html" rel="nofollow">http://www.straub.as/java/pocketapi/index7.html</a> but is in german and so I read it with google translate and I don't know if I got it right but is saying that the classes listed there cannot be reproduced with Class.forname() itself.</p>
  
  <p>Is it true? Is there a reason why this cannot be loaded with reflection or am I doing something wrong?</p>