1

I have a runnable jar file that I've built to work as a form so people can submit help tickets via email to our IT team. There were a few bugs so I thought I'd go back and attempt to fix those minor inconveniences. I finished and tested in Eclipse and everything was working perfectly, so I exported the project back to a runnable jar.

This is where I noticed the issues. From Eclipse, emails will send perfectly, but from the runnable, it spits out the below errors when attempting to submit the form. This by itself I would assume I did something wrong, but additionally, the original runnable (that hasn't been used since October because we were waiting for approval to use the application) gives these same errors now. It 100% was working before.

I have a hard time looking at these and knowing what exactly is wrong. I don't know if it's relevant, but I think the javax.mail.jar file I was originally using got deleted since I kept it in my downloads folder. I assumed it would copy the jar to the project, and evidence suggests that's the case, so I'm unsure why the old one wouldn't work because of that.

Thanks for taking the time to look through this, any help is GREATLY appreciated!


Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/activation/DataHandler
        at emailform.EmailUtility.sendEmail(EmailUtility.java:43)
        at emailform.HelpDeskForm.buttonSendActionPerformed(HelpDeskForm.java:275)
        at emailform.HelpDeskForm.access$1(HelpDeskForm.java:248)
        at emailform.HelpDeskForm$2.actionPerformed(HelpDeskForm.java:231)
        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.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
        at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
        at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
        at java.desktop/java.awt.Component.processEvent(Component.java:6391)
        at java.desktop/java.awt.Container.processEvent(Container.java:2266)
        at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
        at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
        at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
        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.ClassNotFoundException: javax.activation.DataHandler
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        ... 39 more

1 Answers1

0

Found the answer: Exception: java.lang.ClassNotFoundException: javax.activation.DataHandler even though javax.mail.jar is under classpath?

BTW ChatGPT was not able to assist with this. We are safe for now.

  • 1
    There is also [an official migration guide](https://docs.oracle.com/en/java/javase/11/migrate/index.html#JSMIG-GUID-F640FA9D-FB66-4D85-AD2B-D931174C09A3). There are more posts that may help on this site as well (eg [1](https://stackoverflow.com/q/71313332/6746785) and [2](https://stackoverflow.com/q/46493613/6746785)). – gthanop Feb 21 '23 at 16:38