0

There are quite a lot similar questions regarding Eclipse exception: java.lang.ClassNotFoundException, but none of them seems work in my case.

The exception is raised during running my java program from Eclipse, with output message like this: "Caused by: java.lang.ClassNotFoundException: com.alibaba.fastjson.JSON".

I have added fastjson-1.2.62.jar in project->properties->java build path->Libraries->Classpath, so the program can build sucessfully.

How can I make the program find the fastjson library at runtime ?

J. Doe
  • 75
  • 1
  • 9

1 Answers1

0

enter image description hereTry this - under properties click "Run/Debug Settings" - pick/click the launch config you're using, and click the edit button. A window to Edit Launch Config Properties should be there.
Check the settings for Classpath.
I'm guessing that your required jar file isn't on the list there. (Though I'm puzzled why it isn't - possibly other editing prior to this problem?)
Please let me know if this helps (or not). Cheers!

Pete Kelley
  • 3,713
  • 2
  • 16
  • 17
  • I my case there is a tab named "Dependencies" instead of "classpath" between "JRE" and "Source" tabs. Inside "Dependencies" tab, adding jars to "classpath entries" will cause java.lang.ClassNotFoundException for xxx.MainWindow . – J. Doe Feb 24 '20 at 13:36
  • I solved the issue by creating a new configuration where jars appear automatically in the classpath entries inside Dependencies tab. Then it works. – J. Doe Feb 24 '20 at 14:00