title: NetBeans Clean & Build Android error: Java.Lang X500Principal access
body: <p>I’m wondering if anyone can help on this one. An error occurs when cleaning and building the simplest of projects. (see below)</p>
  
  <p>Steps leading to error: </p>
  
  <p>As a new employee and therefore new user on a machine no older than 4 months, I started by opening NetBeans 8.2 - with both NetBeans and Android Studio (for the sdk) installed for me a week before. </p>
  
  <p>There was no Android plugin installed however, so I implemented the nbandroid update centre to install the plugin. I then connected the sdk - found in users\user.user1\AppData\local\android folder - to NetBeans. </p>
  
  <p>In order to run the correct Android version (4.2.2) of a certain project, I firstly installed the versions 4 and up in Android Studio/SDK Manager, before selecting the 4.2.2 in NetBeans.</p>
  
  <p>I proceeded to copy an android project from a shared file server to my local machine before opening the local version in NetBeans. </p>
  
  <p>After Executing a Clean &amp; Build the following error occurs (You may note that there are folder structures that are different to what is stated above. This is due to the testing of different configurations to find a possible solution) : </p>
  
  <pre><code>Current build type is different than previous build: forced apkbuilder run.
  Creating Test-debug-unaligned.apk and signing it with a debug key...
  C:\AndroidSDK\tools\ant\build.xml:958: The following error occurred while executing this line:
  C:\AndroidSDK\tools\ant\build.xml:969: The following error occurred while executing this line:
  C:\AndroidSDK\tools\ant\build.xml:312: 
  java.lang.InternalError: Could not obtain X500Principal access
                  at sun.security.x509.X500Name.&lt;clinit&gt;(X500Name.java:1399)
                  at com.android.sdklib.internal.build.SignedJarBuilder.writeSignatureBlock(SignedJarBuilder.java:384)
                  at com.android.sdklib.internal.build.SignedJarBuilder.close(SignedJarBuilder.java:273)
                  at com.android.sdklib.build.ApkBuilder.sealApk(ApkBuilder.java:795)
                  at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:371)
                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                  at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498)
                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                  at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498)
                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                  at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498)
                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
                  at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                  at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498)
                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
                  at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                  at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498)
                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                  at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498)
                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
                  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
                  at sun.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:498)
                  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
                  at org.apache.tools.ant.Task.perform(Task.java:348)
                  at org.apache.tools.ant.Target.execute(Target.java:435)
                  at org.apache.tools.ant.Target.performTasks(Target.java:456)
                  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
                  at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
                  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
                  at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
                  at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
                  at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
                  at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
  Caused by: java.security.PrivilegedActionException: java.lang.NoSuchMethodException: javax.security.auth.x500.X500Principal.&lt;init&gt;(sun.security.x509.X500Name)
                  at java.security.AccessController.doPrivileged(Native Method)
                  at sun.security.x509.X500Name.&lt;clinit&gt;(X500Name.java:1392)
                  ... 63 more
  Caused by: java.lang.NoSuchMethodException: javax.security.auth.x500.X500Principal.&lt;init&gt;(sun.security.x509.X500Name)
                  at java.lang.Class.getConstructor0(Class.java:3082)
                  at java.lang.Class.getDeclaredConstructor(Class.java:2178)
                  at sun.security.x509.X500Name$1.run(X500Name.java:1384)
                  at sun.security.x509.X500Name$1.run(X500Name.java:1380)
  </code></pre>
  
  <p>This is really strange due to my colleague having no problems compiling on his PC (almost identical PC except with NetBeans 8.1 and Jdk8u91 instead of my latest java) </p>
  
  <p>Solutions already consulted:</p>
  
  <ul>
  <li>Change of locations of Android SDK,JDK, and all relevant
  applications,</li>
  <li>Inserting of Environment Variables such as ANT_HOME,
  JAVA_HOME and ANDROID_HOME, </li>
  <li><p>Installing all plugins and android versions , </p></li>
  <li><p>Inserting Environment Variable Path to the Jdk,</p></li>
  <li><p>Installing solely 4.2.2 version of android in android studio, </p></li>
  <li><p>Complete clean uninstall and reinstall of NetBeans, Android Studio, JDK, Android SDK as the Pc's Admin,</p></li>
  <li><p>Using my colleague as a user, </p></li>
  <li><p>Cleaning and building a simple start up projects, </p></li>
  <li><p>Setting up identical NetBeans inputs as my colleagues',</p></li>
  <li><p>Explored the depths of Google</p></li>
  </ul>
  
  <p>I've checked out permissions and had a little look into Java Principals and Tools, but not 100% sure what I'm doing with that. </p>
  
  <p>Thought I'd consult the stack before trying anything else. Any help is appreciated.</p>