0
votes

I tried to make a exe from a jar file. it did well and when i am running it it gives a notepad error file like this, (when I run this on netbeans(shift+F6) it works properly)

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout at experiments.mp3Player.initComponents(mp3Player.java:115) at experiments.mp3Player.(mp3Player.java:26) at experiments.Main$1.run(Main.java:17) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(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) Caused by: java.lang.ClassNotFoundException: org.netbeans.lib.awtextra.AbsoluteLayout at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 17 more*

2

2 Answers

1
votes

In exe4j, you need to include ALL dependency Jars which your application uses. When you use the Netbeans form editor and it's "default" layout manager, you are required to include it's library Jar, which isn't part of the default JRE.

exe4j

Browse to your projects directory and look in the dist\lib directory. You will need to include ALL the jar files listed within

0
votes

This is because you've compiled it against the netbeans jars, but they aren't included in the class path. One way or another you have to get them on the class path. You could include the libraries in the jar export and they should show up automatically, or you can hardcode their location in your classpath when you start up the exe (edit it's startup script).

I recommend the first option, since it makes it more portable as you go from system to system.