Search code examples
javamavenservletsintellij-ideajavax

Intellij Idea not finding jar


I have a single java file to compile. It uses javax.servlet-api-3.1.0.jar. I added it to maven with mvn-install and it says it built successfully. However, in Intellij it still throws errors during compilation saying:

package javax.servlet does not exist.

This was after restarting it.

Am I missing anything with adding this jar to my program?

Thanks!


Solution

  • You need a pom.xml file in order to build a maven based project. In short, a pom.xml file is used to tell maven how exactly to build your project, and what dependencies it requires. I'd strongly recommend reading the quickstart guide for maven here