How To: Solve “Cannot add Library” Problem (ArrayIndexOutOfBounds) in Netbeans on Vista

Oct 21, 2008 Comments Off on How To: Solve “Cannot add Library” Problem (ArrayIndexOutOfBounds) in Netbeans on Vista Programming, Tutorials & How-tos | Tags: , , ,

Netbeans IDE is one of the famous IDEs used by Java and other programmers and it is especially very good when you are creating graphical user interfaces (GUI) applications.

Lately, I have been working on a java project and I have been facing a problem with using Netbeans on my Microsoft Windows Vista to add external libraries to the project. Normally external libraries are packaged as .jar files.
Netbeans Arrayindexoutofbounds

Whenever I try to click the Add JAR/Folder button as on the screenshot above, instead of getting the Open File dialog, I was getting a java.lang.ArrayIndexOutOfBoundsException error.

Source of the Problem

This is exception is mainly caused because of some incompatibilities issues of the JDK you are using and Microsoft Vista. To be more specific, the java file chooser dialog using WindowsLookAndFeel is incompatible with Ms. Windows Vista on any Java release less than 1.5.0_11 caused by some changes made by Microsoft in Ms. Windows Vista.

Solution to the Problem

To solve this problem,

  • Update your JDK to JDK 6 and above
  • Ensure that your Netbeans IDE uses the new updated JDK instead of the previous JDK which has been upgraded.

Comments are closed.