title: Netbeans exception class not found for javax.swing.JOptionPane
body: <p>I'm pretty fresh in Java and Netbeans Platform programming,  and I have this very strange issue on the one of the examples from the 10 Netbeans API's (file system).
  I'm using Ubuntu 14.10, Java JDK 8, Netbeans 8.0.1</p>
  
  <p>I want to display some data in swing message box after click on the menu element. Imports are fine, dep libs are fine and all compiles fine. But when I click on my superb menu item I have exception:</p>
  
  <pre>
  java.lang.ClassNotFoundException: javax.swing.JOptionPane not found by org.netbeans.word.module.fsdemo [42]
      at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
      at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
      at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
  Caused: java.lang.ClassNotFoundException: *** Class 'javax.swing.JOptionPane' was not found because bundle org.netbeans.word.module.fsdemo [42] does not import 'javax.swing' even though bundle org.apache.felix.framework [0] does export it. Additionally, the class is also available from the system class loader. There are two fixes: 1) Add an import for 'javax.swing' to bundle org.netbeans.word.module.fsdemo [42]; imports are necessary for each class directly touched by bundle code or indirectly touched, such as super classes if their methods are used. 2) Add package 'javax.swing' to the 'org.osgi.framework.bootdelegation' property; a library or VM bug can cause classes to be loaded by the wrong class loader. The first approach is preferable for preserving modularity. ***
      at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1968)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  Caused: java.lang.NoClassDefFoundError: javax/swing/JOptionPane
      at org.netbeans.word.module.fsdemo.MenuViewer.actionPerformed(MenuViewer.java:33)
      at org.openide.awt.AlwaysEnabledAction$1.run(AlwaysEnabledAction.java:199)
      at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
      at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
      at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
      at org.openide.awt.AlwaysEnabledAction.actionPerformed(AlwaysEnabledAction.java:202)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
      at java.awt.Component.processMouseEvent(Component.java:6525)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
      at java.awt.Component.processEvent(Component.java:6290)
      at java.awt.Container.processEvent(Container.java:2234)
      at java.awt.Component.dispatchEventImpl(Component.java:4881)
      at java.awt.Container.dispatchEventImpl(Container.java:2292)
      at java.awt.Component.dispatchEvent(Component.java:4703)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
      at java.awt.Container.dispatchEventImpl(Container.java:2278)
      at java.awt.Window.dispatchEventImpl(Window.java:2739)
      at java.awt.Component.dispatchEvent(Component.java:4703)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
      at java.awt.EventQueue.access$400(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:697)
      at java.awt.EventQueue$3.run(EventQueue.java:691)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
      at java.awt.EventQueue$4.run(EventQueue.java:719)
      at java.awt.EventQueue$4.run(EventQueue.java:717)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
      at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
  [catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
  </pre>
  
  <p>I was trying import all of the javax.spring.* package, but it doesn't work at all.
  Funny, because in other kind of module's classes ( like windows i.e. ) the same code works fine.
  Here's my fancy code to review:</p>
  
  <pre>
  
      package org.netbeans.word.module.fsdemo;
  
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import javax.swing.JOptionPane;
      import org.openide.awt.ActionID;
      import org.openide.awt.ActionReference;
      import org.openide.awt.ActionRegistration;
      import org.openide.filesystems.FileObject;
      import org.openide.filesystems.FileUtil;
      import org.openide.util.NbBundle.Messages;
  
      @ActionID(
              category = "Edit",
              id = "org.netbeans.word.module.fsdemo.MenuViewer"
      )
      @ActionRegistration(
              displayName = "#CTL_MenuViewer"
      )
      @ActionReference(path = "Menu/Edit", position = 2600, separatorBefore = 2550, separatorAfter = 2650)
      @Messages("CTL_MenuViewer=Viewer")
      public final class MenuViewer implements ActionListener {
  
          private FileObject root;
          private FileObject dir;
  
          @Override
          public void actionPerformed(ActionEvent event) {
              root = FileUtil.getConfigRoot();
              dir = root.getFileObject("Menu");
              for (FileObject oneItem : dir.getChildren()) {
                  JOptionPane.showMessageDialog(null, "Info", oneItem.getName(), JOptionPane.INFORMATION_MESSAGE);
              }
          }
      }
  
  </pre>