Results 1 to 6 of 6
- 07-16-2011, 11:09 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 3
- Rep Power
- 0
Please help 'package javax.servlet does not exist'
Hi All,
I am having some issues and need help. I am new at Java developement and need to do an assignment. My Virtual has the following:
- Tomcat 5.5
- jdk 1.5.0_02
- Textpad
I have heard that there are better IDE's but not interested as Textpad is plain and simpel to me for what I need to do.
Now the problem I am getting when importing javax.servlet.* I get the following when compiling
- package javax.servlet does not exist
- cannot find symbol symbol: class HttpServlet
I did research and all says that the classpath needs to change to point to 'C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar'
so I took the steps to do this but then I get another error 'Exception in thread "main" java.lang.NoClassDefFoundError: myTest'.
Can anyone please tell me how would be the simplest to get around this and what am I missing??
Kind regards,
- 07-16-2011, 11:28 AM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
What's the full exception thrown?
- 07-16-2011, 11:49 AM #3
Member
- Join Date
- Jul 2011
- Posts
- 3
- Rep Power
- 0
C:\Documents and Settings\BPUser\Desktop\test.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
C:\Documents and Settings\BPUser\Desktop\test.java:4: cannot find symbol
symbol: class HttpServlet
public class test extends HttpServlet
^
2 errors
Tool completed with exit code 1
- 07-16-2011, 01:35 PM #4
You need both the jar and the current working directory on the classpath. Add a ".;" (windows) or ".:' (*n[ui]x) ahead of the path to the jar.I did research and all says that the classpath needs to change to point to 'C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar'
so I took the steps to do this but then I get another error 'Exception in thread "main" java.lang.NoClassDefFoundError: myTest'.
That's "dot semicolon" or "dot colon" in case the punctuation characters are hard to read.
db
- 07-16-2011, 02:08 PM #5
Member
- Join Date
- Jul 2011
- Posts
- 3
- Rep Power
- 0
Darry thanks for the reply.
Am I correct then in my example below from command prompt?
set CLASSPATH="[SourceFile Directory]".;"[Dir]\api-servlet.jar"
Thanks,
- 07-16-2011, 05:30 PM #6
Similar Threads
-
package javax.swing does not exist
By timosoft in forum AWT / SwingReplies: 5Last Post: 02-15-2011, 01:17 AM -
javax.servet.* does not exist
By junaidsherief in forum Java ServletReplies: 2Last Post: 09-20-2010, 10:18 PM -
package javax.servlet does not exist :>
By wildheart25c in forum Java ServletReplies: 2Last Post: 02-17-2010, 12:02 AM -
package javax.servlet does not exist
By nikhil2jan in forum Java ServletReplies: 1Last Post: 01-04-2009, 04:32 PM -
package mj does not exist
By PzK in forum New To JavaReplies: 8Last Post: 12-03-2008, 10:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks