'org.json.jsonobject class not found when running tomcat

I wrote a servlet that gets a json request and return json in response. For the json processing I used org.json package and when I'm running tomcat9 and sending a request it gets to the servlet but I get error:

Servlet execution threw an exception ... java.lang.ClassNotFoundException: org.json.JSONObject

I don't understand what's missing because I added the org.json.jar file to the CLASSPATH env variable and it was compiled successfully so I guess java knows where to find it. Any help will be appreciated!



Sources

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

Source: Stack Overflow

Solution Source