Forums Register Login

Servlet wont compile

+Pie Number of slices to send: Send
Hi Guys,
I'm doing a course on java but cant seem to get my servlet to compile i keep getting this error im seriously stressed out iv missed my dead line and googled my mind off trying to but cant seem to fix it can some one please help me!!

errors:

C:\Users\Reign\Desktop\WebStocks.java:20: package javax.servlet does not exist
import javax.servlet.*;
^
C:\Users\Reign\Desktop\WebStocks.java:21: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
C:\Users\Reign\Desktop\WebStocks.java:27: cannot find symbol
symbol: class HttpServlet
public class WebStocks extends HttpServlet


I am using textpad to compile and Tomcat as a webserver...

Any help will be great

thanks guys!!
1
+Pie Number of slices to send: Send
How are you setting the classpath for this program during compilation? It looks like you are not including the jar(s) that are necessary for this class to compile. See this FAQ for more details https://coderanch.com/how-to/java/CompilingServlets
1
+Pie Number of slices to send: Send
Those classes don't come with the JRE (or the JDK), so you need to add them to your classpath during compilation. Look for a file called "servlet-api.jar" in the "lib" directory of your Tomcat installation.
+Pie Number of slices to send: Send
@Jaikiran Pai thanks the solution was in your link, it was my environment that wasn't set up correctly! many thank, i was so stuck!
Who knew that furniture could be so violent? Put this tiny ad out there to see what happens:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 522 times.
Similar Threads
How to Deploy servlet using Tomcat 5
How To Compile Servlet
Compler Errors
servlet will not compile aargh
compile errors
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:43:09.