java - Netbeans exception class not found for javax.swing.JOptionPane -


i'm pretty fresh in java , netbeans platform programming, , have strange issue on 1 of examples 10 netbeans api's (file system). i'm using ubuntu 14.10, java jdk 8, netbeans 8.0.1

i want display data in swing message box after click on menu element. imports fine, dep libs fine , compiles fine. when click on superb menu item have exception:

 java.lang.classnotfoundexception: javax.swing.joptionpane not found org.netbeans.word.module.fsdemo [42]     @ org.apache.felix.framework.bundlewiringimpl.findclassorresourcebydelegation(bundlewiringimpl.java:1532)     @ org.apache.felix.framework.bundlewiringimpl.access$400(bundlewiringimpl.java:75)     @ org.apache.felix.framework.bundlewiringimpl$bundleclassloader.loadclass(bundlewiringimpl.java:1955) caused: java.lang.classnotfoundexception: *** class 'javax.swing.joptionpane' not found because bundle org.netbeans.word.module.fsdemo [42] not import 'javax.swing' though bundle org.apache.felix.framework [0] export it. additionally, class available system class loader. there 2 fixes: 1) add import 'javax.swing' bundle org.netbeans.word.module.fsdemo [42]; imports necessary each class directly touched bundle code or indirectly touched, such super classes if methods used. 2) add package 'javax.swing' 'org.osgi.framework.bootdelegation' property; library or vm bug can cause classes loaded wrong class loader. first approach preferable preserving modularity. ***     @ org.apache.felix.framework.bundlewiringimpl$bundleclassloader.loadclass(bundlewiringimpl.java:1968)     @ java.lang.classloader.loadclass(classloader.java:357) caused: java.lang.noclassdeffounderror: javax/swing/joptionpane     @ org.netbeans.word.module.fsdemo.menuviewer.actionperformed(menuviewer.java:33)     @ org.openide.awt.alwaysenabledaction$1.run(alwaysenabledaction.java:199)     @ org.openide.util.actions.actioninvoker$1.run(actioninvoker.java:95)     @ org.openide.util.actions.actioninvoker.doperformaction(actioninvoker.java:116)     @ org.openide.util.actions.actioninvoker.invokeaction(actioninvoker.java:99)     @ org.openide.awt.alwaysenabledaction.actionperformed(alwaysenabledaction.java:202)     @ javax.swing.abstractbutton.fireactionperformed(abstractbutton.java:2022)     @ javax.swing.abstractbutton$handler.actionperformed(abstractbutton.java:2346)     @ javax.swing.defaultbuttonmodel.fireactionperformed(defaultbuttonmodel.java:402)     @ javax.swing.defaultbuttonmodel.setpressed(defaultbuttonmodel.java:259)     @ javax.swing.abstractbutton.doclick(abstractbutton.java:376)     @ javax.swing.plaf.basic.basicmenuitemui.doclick(basicmenuitemui.java:833)     @ javax.swing.plaf.basic.basicmenuitemui$handler.mousereleased(basicmenuitemui.java:877)     @ java.awt.component.processmouseevent(component.java:6525)     @ javax.swing.jcomponent.processmouseevent(jcomponent.java:3321)     @ java.awt.component.processevent(component.java:6290)     @ java.awt.container.processevent(container.java:2234)     @ java.awt.component.dispatcheventimpl(component.java:4881)     @ java.awt.container.dispatcheventimpl(container.java:2292)     @ java.awt.component.dispatchevent(component.java:4703)     @ java.awt.lightweightdispatcher.retargetmouseevent(container.java:4898)     @ java.awt.lightweightdispatcher.processmouseevent(container.java:4533)     @ java.awt.lightweightdispatcher.dispatchevent(container.java:4462)     @ java.awt.container.dispatcheventimpl(container.java:2278)     @ java.awt.window.dispatcheventimpl(window.java:2739)     @ java.awt.component.dispatchevent(component.java:4703)     @ java.awt.eventqueue.dispatcheventimpl(eventqueue.java:746)     @ java.awt.eventqueue.access$400(eventqueue.java:97)     @ java.awt.eventqueue$3.run(eventqueue.java:697)     @ java.awt.eventqueue$3.run(eventqueue.java:691)     @ java.security.accesscontroller.doprivileged(native method)     @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:75)     @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:86)     @ java.awt.eventqueue$4.run(eventqueue.java:719)     @ java.awt.eventqueue$4.run(eventqueue.java:717)     @ java.security.accesscontroller.doprivileged(native method)     @ java.security.protectiondomain$1.dointersectionprivilege(protectiondomain.java:75)     @ java.awt.eventqueue.dispatchevent(eventqueue.java:716)     @ org.netbeans.core.timableeventqueue.dispatchevent(timableeventqueue.java:159) [catch] @ java.awt.eventdispatchthread.pumponeeventforfilters(eventdispatchthread.java:201)     @ java.awt.eventdispatchthread.pumpeventsforfilter(eventdispatchthread.java:116)     @ java.awt.eventdispatchthread.pumpeventsforhierarchy(eventdispatchthread.java:105)     @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:101)     @ java.awt.eventdispatchthread.pumpevents(eventdispatchthread.java:93)     @ java.awt.eventdispatchthread.run(eventdispatchthread.java:82) 

i trying import of javax.spring.* package, doesn't work @ all. funny, because in other kind of module's classes ( windows i.e. ) same code works fine. here's fancy code review:

      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");             (fileobject oneitem : dir.getchildren()) {                 joptionpane.showmessagedialog(null, "info", oneitem.getname(), joptionpane.information_message);             }         }     }  

that because of osgi framework being used. osgi standard modular systems module ("bundle" consisting of (versioned) jars) maybe loaded in isolation dependencies other modules. has life-time management , separation of modules - realized specific class loaders.

this more strict modular system java offers, visibility , versioned dependencies specified. features taken java.

so add bundle dependency swing. unfortunately @ moment without netbeans ide check.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -