Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError

собрал не давно jar файл и заметил что не работает функция из другого класса. Выдаёт ошибку:

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
        at Main.window$14.actionPerformed(window.java:382)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
        at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
        at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
        at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1022)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1066)
        at java.desktop/java.awt.Component.processMouseEvent(Component.java:6617)
        at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
        at java.desktop/java.awt.Component.processEvent(Component.java:6382)
        at java.desktop/java.awt.Container.processEvent(Container.java:2264)
        at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4993)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2322)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4934)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4563)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4504)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2308)
        at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.NullPointerException: Cannot invoke "java.awt.image.BufferedImage.getWidth()" because "<parameter1>" is null
        at jaco.mp3.player.F.c(Unknown Source)
        at jaco.mp3.player.F.a(Unknown Source)
        at jaco.mp3.player.plaf.a.<init>(Unknown Source)
        at jaco.mp3.player.plaf.a.<init>(Unknown Source)
        at jaco.mp3.player.plaf.MP3PlayerUI.a(Unknown Source)
        at jaco.mp3.player.plaf.MP3PlayerUI.installUI(Unknown Source)
        at java.desktop/javax.swing.JComponent.setUI(JComponent.java:685)
        at java.desktop/javax.swing.JPanel.setUI(JPanel.java:150)
        at java.desktop/javax.swing.JPanel.updateUI(JPanel.java:126)
        at java.desktop/javax.swing.JPanel.<init>(JPanel.java:86)
        at java.desktop/javax.swing.JPanel.<init>(JPanel.java:109)
        at java.desktop/javax.swing.JPanel.<init>(JPanel.java:117)
        at jaco.mp3.player.MP3Player.<init>(Unknown Source)
        at Main.workwithfile.<clinit>(workwithfile.java:19)
        ... 38 more

Код функции:

static File file;
    static JFileChooser chooser = new JFileChooser(System.getProperty("user.home"));
    static FileNameExtensionFilter filter = new FileNameExtensionFilter("MP3 File", "mp3");
    static MP3Player player = new MP3Player();
    
    static void openfile() {
        chooser.setFileFilter(filter);
        chooser.setDialogTitle("Choose file to play");
        chooser.setApproveButtonText("Play!");
        int c = chooser.showOpenDialog(chooser);
        if(c == JFileChooser.APPROVE_OPTION) {
            if(player != null && !player.isStopped()) {
                player.stop();
            }
            file = new File(chooser.getSelectedFile().toString());
            player.addToPlayList(file);
            window.frmAdvancedaudioplayer.setTitle("AdvancedAudioPlayer 0.1(Alpha)");
            player.setRepeat(false);
            window.play.setEnabled(true);
            window.closeitem.setEnabled(true);
            JOptionPane.showMessageDialog(null, "File opened successfully!");
        }
    }

Код кнопки из которой вызываем функцию:

static JMenuItem openitem = new JMenuItem("Open(ctrl + O)");
openitem.setCursor(new Cursor(Cursor.HAND_CURSOR));
        openitem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                workwithfile.openfile();
            }
        });

Ответы (0 шт):