0

I am using Intellij Community Edition to build a simple Maven project web app. It's getting compile errors:

java: package javax.servlet.http does not exist

java: cannot find symbol symbol: class HttpServlet

java: cannot find symbol symbol: class HttpServletRequest

java: cannot find symbol symbol: class HttpServletResponse

I used to use Jave SE. I have downloaded Jave EE. All it told me to do was unzip (I guess that means it's installed). I'm also using Tomcat 6.0.53 and Maven 3.5.0

Other similar questions on here said to add dependencies but they did not work for me.

My code is attached:

package org.mycompany.myname;

import javax.servlet.http.*;

import java.io.IOException;

public class HelloServlet extends HttpServlet {
public void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException
{
    httpServletResponse.getWriter().print("Test running ...");
}
}
1
  • Wrong all around. Has nothing to do with IntelliJ. You should not unzip anything. You just need to add the javax.servlet JAR to your CLASSPATH when you compile. Tomcat will have it in its /lib folder when you run. Commented Sep 5, 2017 at 12:12

1 Answer 1

0

Found the problem. The version I designated for Java EE in the pom.xml was wrong.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.