'Problems with the Java Build Path

When I create a runnable .jar file in Eclipse, I get the following error upon running the .jar:

java.lang.ClassNotFoundException: com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

It runs fine in Eclipse, just not from a .jar file. I'm compiling using JDK 1.8.0_92 and I've installed the latest JRE.

When I comment out the line:

UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

It runs fine but doesn't then seem to be loading the json-simple-1.1.1.jar library that I've also added to the classpath.

If I compile it as a normal .jar file and run it from the cmd prompt, it gives me the error:

Caused by: java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException

My build path looks like:

It's been a long time since I last compiled Java in Eclipse so I'm certain there's something I'm doing wrong but at the moment it just feels like Eclipse isn't including the resources properly.

I've tried tinkering with the class path and adding different JDK versions but it hasn't helped.

I've searched on here too and other people who have had similar problems seem to have been failing to add the required libraries to the class path, whereas I'm fairly sure I've done what's needed there. Having said that, there's bound to be something I'm missing.

Need help from someone cleverer than me!

Cheers.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source