It works fine when the project is compiled, but after exporting it to a runnable jar
and launching, it can't find external jar files and throws an error. What should I do?
How to attach libraries to JAR file?
You could attempt building a fat jar
that includes all the jars. It contains a custom class loader to load the jars referenced externally by your project.
Try using http://fjep.sourceforge.net/ plugin to build a fat jar.
You can export a java project containing jars using the File -> Export -> Other -> One Jar Exporter
.
The jar thus exported works fine.