JFileChooser throws NoClassDefFoundError in constructor

I have a commandline application that shows a dialog with a button. In case the button is clicked a JFileChooser shall be opened.
This works perfectly when the application starts from my IDE or through a starter windows executable.
But the purpose of this application is to be run from another (old) java application a a sysem process (Runtime.exec()). In this case the JFileChooser does not open but throws an Exception: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.shell.Win32ShellFolder2
         at sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.java:277)
         at sun.awt.shell.ShellFolder.get(ShellFolder.java:227)
         at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$LazyWindowsIcon.createValue(WindowsLookAndFeel.java:2206)
         at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:199)
         at javax.swing.UIDefaults.get(UIDefaults.java:144)
         at javax.swing.MultiUIDefaults.get(MultiUIDefaults.java:47)
         at javax.swing.UIDefaults.getIcon(UIDefaults.java:431)
         at javax.swing.UIManager.getIcon(UIManager.java:732)
         at javax.swing.plaf.basic.BasicFileChooserUI.installIcons(BasicFileChooserUI.java:237)
         at javax.swing.plaf.basic.BasicFileChooserUI.installDefaults(BasicFileChooserUI.java:219)
         at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:135)
         at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(WindowsFileChooserUI.java:129)
         at javax.swing.JComponent.setUI(JComponent.java:673)
         at javax.swing.JFileChooser.updateUI(JFileChooser.java:1763)
         at javax.swing.JFileChooser.setup(JFileChooser.java:360)
         at javax.swing.JFileChooser.<init>(JFileChooser.java:333)
         at javax.swing.JFileChooser.<init>(JFileChooser.java:286)
         at last line of my code calling new JFileChooser()How can I solve this problem or gather mor information about it?
The class having a problem is in rt.jar in the package 'sun.awt.shell' but the src.jar does not contain souce files for package 'sun'. Where can I find those sources?
bye
TPD

I tried to change he JFileChooser to a FileDialog, but it'd the same problem.
I figured out, that when failing the windows environment variables are almost empty. I found only 2 entries:    PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS
    PROMPT = $P$G
    COMSPEC = C:\WINDOWS\system32\cmd.execould that be part of the problem?
bye
Thomas

Similar Messages

  • Constructor of JFileChooser throws Exception

    Hi,
    I have a big problem when i call the constructor of JFileChooser.
    StackTrace:
    UIDefaults.getUI() failed: createUI() failed for javax.swing.JFileChooser[,0,0,0x0,invalid,alignmentX=null,alignmentY=null,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,approveButtonText=,currentDirectory=,dialogTitle=,dialogType=OPEN_DIALOG,fileSelectionMode=FILES_ONLY,returnValue=ERROR_OPTION,selectedFile=,useFileHiding=true] java.lang.reflect.InvocationTargetException
    java.lang.Error
         java.lang.Throwable()
         java.lang.Error()
         void javax.swing.UIDefaults.getUIError(java.lang.String)
         javax.swing.plaf.ComponentUI javax.swing.UIDefaults.getUI(javax.swing.JComponent)
         javax.swing.plaf.ComponentUI javax.swing.UIManager.getUI(javax.swing.JComponent)
         void javax.swing.JFileChooser.updateUI()
         void javax.swing.JFileChooser.setup(javax.swing.filechooser.FileSystemView)
         javax.swing.JFileChooser(java.io.File, javax.swing.filechooser.FileSystemView)
         javax.swing.JFileChooser()
         de.mus.flatfile.FlatfileGUI()
         de.mus.flatfile.FlatfileGUI de.mus.flatfile.FlatfileGUI.getInstance()
         void de.mus.flatfile.StartFlatfileImport.start()
         de.mus.flatfile.StartFlatfileImport()
         void de.mus.flatfile.StartFlatfileImport.main(java.lang.String [])
    The problem seems to be that updateUI calls UIManager.getUI(this), but this returns null.
    The strange thing is that it has always worked, but since yesterday i get that error.
    Does anyone know this problem and can help me?
    thanks in advance,
    Philip

    btw, im using VisualAge with jdk1.2.2

  • WAR deployed on 10.3.1.0 throws NoClassDefFoundError

    Hello,
    I made a little web application using NetBeans that contains a web service. Now I try to deploy this app on a Weblogic 10 server.
    The app is configured as JEE 5 app with JDK 5.
    On a Windows and Linux machine running version 10.3.3.0 it works fine.
    On a AIX machine running 10.3.1.0 I can deploy the app to Prepared state, but when I hit Start servicing all requests it throws this error:
    ava.lang.NoClassDefFoundError: com.sun.xml.ws.api.BindingID (initialization failure)
    I'm not very familiarized with Weblogic so does anybody knows what library it needs and where should I put it?
    Thanks!
    Adrian

    Solved by adding jaxws-rt-2.1.3.jar to
    /w01/oracle/bea/user_projects/domains/Domain/lib
    and
    /w01/oracle/bea/wlserver_10.3/server/bin

  • Can I throw exception in constructor?

    I just want to add some constraints on the object.
    I'm thinking to add the constraints to the constructor, when every time create a new object , check first. If obey the rule, that's fine. If not, just throw it? Can I do like this way??
    e.g Class Distance
    Distance(x){if x >= 0.0  dist = x  else throw...}
    float dist;
    }

    The best exception to throw in that case is IllegalArgumentException..
    class Distance {
        float dist;
        Distance(float x) {
            if (x < 0.0) {
                throw new IllegalArgumentException("x must be non-negative");
            dist = x;
    }

  • Custom Indirection Container throwing exception in constructor

    Hi I've following the how-to and implemented my own custom indirection container. However, when reading an object from the database I'm getting the following exception. I'm guessing that it could be related to having null references stored as 0 in id columns. Any help would be greatly appreciated.
    Thanks,
    Jon
    Exception thrown in main Exception [TOPLINK-152] (OracleAS TopLink - 10g (9.0.4.8) (Build 050712)):
    oracle.toplink.exceptions.DescriptorException
    Exception Description: The operation [buildContainer constructor (null) Failed: java.lang.NullPointe
    rException] is invalid for this indirection policy [oracle.toplink.internal.indirection.ContainerInd
    irectionPolicy@cc0e01].
    Mapping: oracle.toplink.mappings.OneToOneMapping[ryFromMail]
    Descriptor: Descriptor(com.peoplesoft.crm.omk.design.PsRyedocVar --> [DatabaseTable(PS_RYEDOC_VAR)])
    Local Exception Stack:
    Exception [TOPLINK-152] (OracleAS TopLink - 10g (9.0.4.8) (Build 050712)): oracle.toplink.exceptions
    .DescriptorException
    Exception Description: The operation [buildContainer constructor (null) Failed: java.lang.NullPointe
    rException] is invalid for this indirection policy [oracle.toplink.internal.indirection.ContainerInd
    irectionPolicy@cc0e01].
    Mapping: oracle.toplink.mappings.OneToOneMapping[ryFromMail]
    Descriptor: Descriptor(com.peoplesoft.crm.omk.design.PsRyedocVar --> [DatabaseTable(PS_RYEDOC_VAR)])
    at oracle.toplink.exceptions.DescriptorException.invalidIndirectionPolicyOperation(Descripto
    rException.java:669)
    at oracle.toplink.internal.indirection.ContainerIndirectionPolicy.buildContainer(ContainerIn
    directionPolicy.java:62)
    at oracle.toplink.internal.indirection.ContainerIndirectionPolicy.valueFromQuery(ContainerIn
    directionPolicy.java:254)
    at oracle.toplink.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java
    :898)
    at oracle.toplink.mappings.OneToOneMapping.valueFromRow(OneToOneMapping.java:1302)
    at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:876)
    at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder
    .java:164)
    at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:322)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:
    242)
    at oracle.toplink.queryframework.ReadObjectQuery.execute(ReadObjectQuery.java:368)
    at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:510)
    at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:125)
    at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1962)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.internal.indirection.NoIndirectionPolicy.valueFromQuery(NoIndirectionPolic
    y.java:254)
    at oracle.toplink.mappings.ForeignReferenceMapping.valueFromRow(ForeignReferenceMapping.java
    :898)
    at oracle.toplink.mappings.OneToOneMapping.valueFromRow(OneToOneMapping.java:1302)
    at oracle.toplink.mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:876)
    at oracle.toplink.internal.descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder
    .java:164)
    at oracle.toplink.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:322)
    at oracle.toplink.queryframework.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:
    242)
    at oracle.toplink.queryframework.ReadObjectQuery.execute(ReadObjectQuery.java:368)

    Clients of your class might not like you throwing
    exceptions from the ctor. If they're checked
    exceptions it'll mean try/catch blocks. If there are
    LOTS of checked exceptions that'll mean lots of catch
    blocks. Could get messy fast. You could catch in the
    ctor and wrap in a subclass of
    java.lang.RuntimeException. Those are unchecked, like
    java.lang.IllegalArgumentException.I would strongly advise against making your checked exceptions unchecked just so that the caller's code will compile without try/catch blocks. Either way--checked or unchecked--if I do Foo foo = new Foo();
    foo.doStuff(); I won't get to doStuff() if the ctor threw an exception.
    You'd throw unchecked exceptions in those cases where it's appropriate--e.g., the caller passed you invalid args (bad code on the caller's part, appropriated for unchecked exception), or the VM couldn't get enough memory to create your object (probably not something the caller can do anything about, so, again, appropriate for unchecked).
    But if, for example, he's passing you database login parameters that an end user provided, and the password is wrong or the host is unreachable, then you'd want to throw a checked exception, because it's not bad code on the caller's part, and there might be something he can do to recover.
    Note that the example of the incorrect password above is quite different from the "invalid args" example in the previous paragraph. Your method would throw IllegalArgumentException if the caller passed args that violate your method's precondition--e..g. lie outside some range of numbers. That is, it's a value that your method simply can't use. A bad password for a db login, on the other hand, is legal as far as your method is concerned, it just failed authentication in the db.
    @%: I know you're aware of the proper use of checked/unchecked exceptions, but the way you worded you post kind of sounded like you were saying, "just use unchecked if you find the caller has too many try statements."
    &para;

  • Web Dynpro Application throws NoClassDefFoundError for IAspect

    Hi All
    I decided to teach myself a little bit more about Web Dynpros and the Composite Application Framework and as such started working through SAP's tutorials. Currently I'm busy with 'Using a Composite Application via a Web Dynpro UI' - at the section where I need to programmatically populate a DropDownByKey with the location names. I followed the tutorial's instructions step for step, but after deploying and running my application I receive the following error message:
    java.lang.NoClassDefFoundError: com/sap/tc/col/client/generic/api/IAspect
    Sometimes IAspect is replaced by IStructure.
    The detailed error provides this message:
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to create delegate for component com.sap.carpool.travel.Travel. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
    It seems as if it is struggling to find the DC containing IAspect and IStructure, but I have included
    tc/col/runtime (default)
    in the 'Used DCs' of my Web Dynpro DC.
    Any ideas what might be causing this or how to fix it?
    Thanks in advance,
    JP

    Hi Valery,
    Thanks for the reply.
    It seems like that to me as well. I can use the code as I've imported
    com.sap.tc.col.client.generic.api.IAspect;
    , but when it actually tries and load the implementation it can't find it?
    Unfortunately, checking the run-time (or build or deploy time) checkboxes on tc/col/runtime did not help.

  • Weblogic 8.1SP2 throws noclassdeffounderror for ActionServlet

    Hi All,
              My application(struts based) works fine in weblogic7 and the same is deployed sucesfully in weblogic8.1 SP2 but on starting the weblogic server the following error is thrown
              ******************error starts here*******************
              <Jul 9, 2004 3:45:43 PM GMT+05:30> <Error> <HTTP> <BEA-101250> <[ServletContext(id=18734604,name=gsrs_admin,context-path
              =/gsrs_admin)]: Servlet class com.jpmorgan.grc.gsr.admin.AdminToolActionServlet for servlet admintool could not be loade
              d because a class on which it depends was not found in the classpath C:\bea8.2\weblogic81\server\bin\myserver\.wlnotdele
              te\gsrs\gsrs_admin.war;C:\bea8.2\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_gsrs_gsrs_admin\jarfiles
              \WEB-INF\lib\jstl31232.jar;C:\bea8.2\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_gsrs_gsrs_admin\jarf
              iles\WEB-INF\lib\standard31233.jar;C:\bea8.2\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_gsrs_gsrs_ad
              min\jarfiles\WEB-INF\lib\struts31234.jar.
              java.lang.NoClassDefFoundError: org/apache/struts/action/ActionServlet.>
              <Jul 9, 2004 3:45:43 PM GMT+05:30> <Error> <HTTP> <BEA-101216> <Servlet: "admintool" failed to preload on startup in Web
              application: "gsrs_admin".
              javax.servlet.ServletException: [HTTP:101250][ServletContext(id=18734604,name=gsrs_admin,context-path=/gsrs_admin)]: Ser
              vlet class com.jpmorgan.grc.gsr.admin.AdminToolActionServlet for servlet admintool could not be loaded because a class o
              n which it depends was not found in the classpath C:\bea8.2\weblogic81\server\bin\myserver\.wlnotdelete\gsrs\gsrs_admin.
              war;C:\bea8.2\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_gsrs_gsrs_admin\jarfiles\WEB-INF\lib\jstl31
              232.jar;C:\bea8.2\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_gsrs_gsrs_admin\jarfiles\WEB-INF\lib\st
              andard31233.jar;C:\bea8.2\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_gsrs_gsrs_admin\jarfiles\WEB-IN
              F\lib\struts31234.jar.
              java.lang.NoClassDefFoundError: org/apache/struts/action/ActionServlet.
              at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:805)
              at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3252)
              at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3209)
              at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3195)
              at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3174)
              at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:688)
              at weblogic.servlet.internal.WebService.preloadResources(WebService.java:483)
              at weblogic.servlet.internal.ServletInitService.resume(ServletInitService.java:30)
              at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
              at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:964)
              at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:359)
              at weblogic.Server.main(Server.java:32)
              >
              ***************error ends here*********************
              any help is appreciated
              rgrds and thx
              gnana

    Hi All,
              <br>
              <br>
              My application was working fine on weblogic7. Recently i have installed weblogic8.1 SP4. We are using managed weblogic servers. I got noclassdeffounderror for a class on the deployment of the application or on the start one of the servers.
              <br>
              <br>
              <b>Strange thing is that the class it is complaining is there in the jar and the jar is there in the classpath which it displays along with the error.</b>
              <br>
              <br>
              I dont know why its not picking up that class. I verifed the classpath by setting it on command line and then tried to use that particular class and it was working.
              <br>
              <br>
              I also tried to put the particular class in web-inf/classes directory and to my surprise it is also not working. still it is giving the same error. Then I tried to put the jar in the web-inf/lib but even in this case also i got the same error.
              <br>
              <br>
              Is there something wrong in the setup/configuration of the server?? or is it anyway related to the environment(like xp,2000,environment variables etc) where the server is installed?? or is weblogic8.1 has some problem in picking classes form classpath or web-inf/classes/ for some particular cases??
              <br>
              <br>
              Anybody has any idea why weblogic8.1 is behaving this way??
              <br>

  • JFileChooser throws null pointer exception

    I'm using JFileChooser in my gui class. After I make my selection in the file chooser it sets off a null pointer exception. I'm running windows xp professiona. It was working perfectly fine till recently.
    My code for calling the chooser is:
        JFileChooser chooser = new JFileChooser();
        int returnVal = chooser.showOpenDialog(this);
        if(returnVal == chooser.APPROVE_OPTION){
          //setup the client now with the selected file to send
          client.setFile(chooser.getSelectedFile());
          jLabel5.setText(chooser.getSelectedFile().getName());
        }java.lang.NullPointerException
         at ftpresume.ClientGUI.jButton2_actionPerformed(ClientGUI.java:128)
         at ftpresume.ClientGUI_jButton2_actionAdapter.actionPerformed(ClientGUI.java:174)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    I took a look at checking to see if the file is valid, exists, is readable and everything else. Looks like the file that's returned if fine. I'm not sure why my program crashes when I setup the file though. Here's my code from the client.setFile(File f);
    public void setFile(File f){
        if(f!=null){
          this.f = f;
          try {
            channel = new FileInputStream(f).getChannel();
            client.setupProgressBar(0,(int)f.length());
          }catch (FileNotFoundException e) {client.showError("FileNotFoundException: " + e);}
          catch(IOException e){client.showError("IOException: " + e);}
      }

  • JFileChooser throws NullPointerException when in a non-traversable Dir

    Hi all
    I think I found a bug of JFileChooser. Unless one of you knows the issue and the corresponding workaround.
    It occurs when one extends JFileChooser and overrides isTraversable() to dissalow the navigation to specific
    directories. When the user then uses the JComboBox of the JFilechooser dialog to navigate to a non-allowed
    directory and from there tries to again select a not allowed directory, the following Exception gets thrown
    within the JFileChooser.showDialog method.
    To reproduce this try:
    import java.io.File;
    import javax.swing.JFileChooser;
    public class   yxJFileChooser
           extends   JFileChooser
        public boolean isTraversable(File _f)
                 if  (_f == null)       return false;
            else if (!_f.isDirectory()) return false;
            String fileToCheck = _f.getAbsolutePath().toLowerCase();
            if (fileToCheck.startsWith("c:\\windows")) return true;
            else                                       return false;
    }the try:
             yxJFileChooser fc = new yxJFileChooser();
             int ret = fc.showDialog(null,"try the combo twice. Choose both times a non traversable dir");Once you have chosen for the second time a non-valid directory (using the combo) you will get a NullPointerException:
    Is this indeed a Java VM bug or am I doing something wrong?
    My operating system is Windows XP service pack 2 and the java version I am running this with is:
    java version "1.6.0-rc"
    Java(TM) SE Runtime Environment (build 1.6.0-rc-b102)
    Java HotSpot(TM) Client VM (build 1.6.0-rc-b102, mixed mode)

    Here the Exception:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at javax.swing.plaf.metal.MetalFileChooserUI$DirectoryComboBoxAction.actionPerformed(Unknown Source)
    at javax.swing.JComboBox.fireActionEvent(Unknown Source)
    at javax.swing.JComboBox.setSelectedItem(Unknown Source)
    at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
    at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.Dialog$1.run(Unknown Source)
    at java.awt.Dialog$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Dialog.show(Unknown Source)
    at javax.swing.JFileChooser.showDialog(Unknown Source)
    at yx.filearchiver.sh.getFileNameFromUser(Unknown Source)
    at yx.filearchiver.gui.pnl4ActionListener.actionPerformed(Unknown Source)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

  • JFileChooser throws NullPointerException

    Dear all,
    Please check out the following code:
    JFileChooser addItemChooser = new JFileChooser();
    addItemChooser.setMultiSelectionEnabled(true);
    int returnVal = addItemChooser.showDialog( SAP_Functions.this, "Add" );     
    if (returnVal == JFileChooser.APPROVE_OPTION)
    File selectedFiles[] = listFileChooser.getSelectedFiles();
    When running the program i get the FileChooser but when i approve the selection the compiler gives me a NullPointerException message, what are the possible reasons for it?
    Thanks for your help.
    Kareem Naouri

    Looking at your code, I think what you mean to do is
    File[] selectedFiles = addItemChooser.getSelectedFiles();
    That is call getSelectedFiles() on the JFileChooser object that you have declared and instantiated within your code.

  • Changing L&F for the JFileChooser

    Hi,
    take a look at Sun's bug #4711700. Using the Windows L&F, sometimes the JFileChooser throws a NullPointerException when the constructor is called.
    Apparently, the bug is related to retrieving Windows system icons to be shown in the dialog, so it's probably not there when using a non Windows L&F.
    As my app needs to use the L&F of the host OS, I was thinking about using a workaround like this:
    JFileChooser jfc;
    try {
      jfc = new JFileChooser(...);
    } catch(NullPointerException ex) {
      /* change L&F for file chooser here */
      jfc = new JFileChooser();
    }This may not be very appealing, but it's definitely better than the exception!
    The question is: it possible to selectively change the L&F for the file chooser, without affecting the rest of the components, and how do I do it?

    JFileChooser fileChooser=new JFileChooser();// to choose the file ExampleFileFilter filter = new ExampleFileFilter();// to make file settings
         filter.addExtension("jpeg");
         filter.addExtension("jpg");
         filter.setDescription("Image Format");
         fileChooser.setFileFilter(filter);//new File(".")
         fileChooser.setCurrentDirectory(new File("."));
         int result = fileChooser.showOpenDialog(printFrame);//to open dialog box
         if(result==JFileChooser.CANCEL_OPTION)
                   file=null;
    try this u can solve ur problem and , write example filter class
    //ExampleFilter.java
    import java.io.File;
    import java.util.Hashtable;
    import java.util.Enumeration;
    import javax.swing.filechooser.*;
    public class ExampleFileFilter extends FileFilter {
    private static String TYPE_UNKNOWN = "Type Unknown";
    private static String HIDDEN_FILE = "Hidden File";
    private Hashtable filters = null;
    private String description = null;
    private String fullDescription = null;
    private boolean useExtensionsInDescription = true;
    public ExampleFileFilter() {
              this.filters = new Hashtable();
    public ExampleFileFilter(String extension) {
         this(extension,null);
    public ExampleFileFilter(String extension, String description) {
         this();
         if(extension!=null) addExtension(extension);
         if(description!=null) setDescription(description);
    public ExampleFileFilter(String[] filters) {
         this(filters, null);
    public ExampleFileFilter(String[] filters, String description) {
         this();
         for (int i = 0; i < filters.length; i++) {
         addExtension(filters);
         if(description!=null) setDescription(description);
    public boolean accept(File f) {
         if(f != null) {
         if(f.isDirectory()) {
              return true;
         String extension = getExtension(f);
         if(extension != null && filters.get(getExtension(f)) != null) {
              return true;
         return false;
    public String getExtension(File f) {
         if(f != null) {
         String filename = f.getName();
         int i = filename.lastIndexOf('.');
         if(i>0 && i<filename.length()-1) {
              return filename.substring(i+1).toLowerCase();
         return null;
    public void addExtension(String extension) {
         if(filters == null) {
         filters = new Hashtable(5);
         filters.put(extension.toLowerCase(), this);
         fullDescription = null;
    public String getDescription() {
         if(fullDescription == null) {
         if(description == null || isExtensionListInDescription()) {
              fullDescription = description==null ? "(" : description + " (";
              // build the description from the extension list
              Enumeration extensions = filters.keys();
              if(extensions != null) {
              fullDescription += "." + (String) extensions.nextElement();
              while (extensions.hasMoreElements()) {
                   fullDescription += ", ." + (String) extensions.nextElement();
              fullDescription += ")";
         } else {
              fullDescription = description;
         return fullDescription;
    public void setDescription(String description) {
         this.description = description;
         fullDescription = null;
    public void setExtensionListInDescription(boolean b) {
         useExtensionsInDescription = b;
         fullDescription = null;
    public boolean isExtensionListInDescription() {
         return useExtensionsInDescription;
    try this u can solve ur problem and , write example filter class
    cheers
    nr konjeti

  • Send java mail throws KM - problems sendMail

    Hellow
    I implementing the Java send mail post in
    send mail throws NoClassDefFoundError: javax/mail/MessagingE
    But I have a little problem with the sentence:
    <b>sendMailSvc.sendMail(mailItem, iuser);</b>
    The stranger is that NetWeaver protests to me that:
    <i>The Method sendMail(IResource, IUser) in the type ISendMailService is not applicable for the arguments (ISendMailItems, IUser)</i>
    But in the class, NetWeaver showme sendMailSvc.(Ctrl+Space) two Method send mail
    1) sendMail(IResource arg0, IUser arg1)
    2) sendMail(ISendMailItem arg0, IUser arg1)
    Why it does not take the second method? I do not understand
    Regards !!

    Thanks Detlev for your answer
    I  import IUser from :
    <b>import com.sap.security.api.IUser;</b>
    and initialize the variable user :
    <b>     IWDClientUser user;
         IUser iuser = user.getSAPUser();</b>
    but you say to me that it would have to use:
    <b>import com.sapportals.portal.security.usermanagement.IUser;</b>
    how I can initialize the variable "user" for:?
    <i>ISendMailItem mailItem = null;
                   try {
                             mailItem = sendMailSvc.createMailItem();
                             mailItem.setContent("Test");
                             mailItem.setTo("[email protected]");
                             <b>sendMailSvc.sendMail(mailItem, user);</b></i>     
    Regards for your help !!!

  • How to handle exception on a backing bean constructor ?

    Hello,
    I would like to handle the exceptions throw on the constructor of a backing bean, and redirect the user to a "service not available" page.
    When I use "request.sendRedirect()" method to redirect the user to such page, I logically got an "IllegalStateException: Cannot forward a response that is already committed".
    Do you have any idea how can I redirect or forward a user to a page when the response is already commited? Is it possible to use servlet filter and do a forward after the doFilter()?
    Thank you.

    Just throw the exception and map an error page in the web.xml.
    <error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>error.jsp</location>
    </error-page>

  • Nullpointer when creating JFileChooser

    I am launching a regular java app in a Desktop I created ( CreateDesktop() ) on a Windows 7 64 bit box. The code is all compiled in 32 bit, and the JVM being used to launch the app is also 32 bit. IN this application I create a JFileChooser object, JFileChooser fc = new JFileChooser(); etc, etc, etc.
    This and all the other code associated with it works fine. When I take all the same identical binaries, JVM and all, to a Windows 7 32 bit box JFileChooser throws a null pointer exception when creating it.
    The app also work just fine in the 32 bit machine if I launch it in the default Windows destop.
    Does anyone have any idea what's going on and the inconsistency between Windows 7 32 bit and 64 bit?
    Thanks Al Harper

    For the person that asked here's the code snippet:
    JFileChooser chooser = new JFileChooser();
    File f = new File("resources");
    It never makes it to the File f = new File("resources") line.
    This is very old code that has been running for 10+ years on a variety of Windows OS's. This problem didn't start till Windows 7.
    For gimbal2 ... Your statement "You apparently don't even consider that your own code can have a problem" is a rude and arrogant statement. We always consider that possibility. We are NOT JVM pessimists. I come to these post for help, NOT JUDGEMENTS!!! Keep your opinions to yourself!
    Al

  • JFileChooser in signed Jarred JApplet

    hi,
    I have signed a JApplet, it has access to the disk, but launching a JFileChooser throws a security error.
    please help!
    java.security.AccessControlException: access denied (java.io.FilePermission)
    thanks,
    asjf

    When you sign the jar file using JARSIGNER, you are supposed to give the name of the jar file that is to be signed and also the "alias name" of the public/private key that you would have created using KEYTOOL. If you have not done it, you need to create a new self-signed test certificate using KEYTOOL. Just type the following command at the command prompt
    C:\>keytool -genkey -alias MyCertificate -keyalg RSA -storepass <your keystore password>
    This would prompt you with some simple questions and at the end, a self-signed certificate would be created at C:\Winnt\Profiles\<your profile name>\.keystore (this is applicable only for Windows).
    Now you can sign your jar file using this "alias name" that was given at the time of creation of the certificate.
    HTH
    Vignessh.

Maybe you are looking for

  • Safari won't open page due to certificate error

    I incorrectly clicked on something when opening a new page and now the page won't open anymore.  The error I get is "the server "shop.rcbs.com" did not accept the certificate".  How do I fix this? JT

  • Random images display strong yellow/green cast

    system - 24" intel iMac, 3ghz, 2gb, 500bg hd, NVIDIA GeForce 8800 GS with 512MB memory, OS 10.5.4. Just purchased. System runs fine, and I love the machine. Problem is random images, jpegs, raw, illustrator files, display an awful yellowish tint, bot

  • Accessing properties of loaded WindowedApplication from the Main WindowedApplication.

    Hi Friends. I am trying a project and according to my plans I am trying for some thing but don't know is it possible.. I am compiling multiple air applications and One of them will be the main application. and another will not be actually *.air but t

  • Can I use a "T" shaped charger?

    The charger to my A1370 MacBook Air just recently frayed out.  I'm a bit catious of buying another "L" shaped one, so I'm wondering if a "T" shaped one would be a good subsitute and which model of it to buy.

  • Multi-plot graphs

    Hello, I would like to draw a graph that has four different plots (same x-axis), in addition I want to see all the prvious points of measurement. Thanks in advance, Gaby