This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Will not compile with javax.servlet.jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Will not compile with javax.servlet.jsp" Watch "Will not compile with javax.servlet.jsp" New topic
Author

Will not compile with javax.servlet.jsp

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
I attempted to compile a file called SizeTag.java
containing the following import statements:-
import java.io.*;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class SizeTag extends javax.servlet.jsp.tagext.TagSupport {
I got the following error:-
SizeTag.java:13: Package javax.servlet.jsp not found in import.
import javax.servlet.jsp.*;
^
SizeTag.java:14: Package javax.servlet.jsp.tagext not found in import.
import javax.servlet.jsp.tagext.*;
^
There seems to be a pronlem with the .jsp ???
Joe Paolangeli
Ranch Hand

Joined: Apr 05, 2000
Posts: 73
I think you are missing a reference to a jar file in your class path.
I am not sure what web server you are using. For the JSWDK 1.0.1 web server you need to add jspengine.jar, servlet.jar, xml.jar, and webserver.jar to your class path. For Tomcat you need to add jasper.jar, servlet.jar, xml.jar, and webserver.jar.
Good Luck!
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Alkesh,
Have you edited the 'classpath' variable in your c:\autoexec.bat file? We have to include the servlet.jar file in the classpath in order ro compile servlet files. In other words, try to include the following
set classpath=c:\(the dir name where "\lib\servlet.jar" exists)\lib\servlet.jar;
If you have installed in c:\jswdk-1.0.1 then include the following. Basically you include the full path name of servlet.jar in the classpath.
set classpath=c:\jswdk-1.0.1\lib\servlet.jar;
regds
maha anna

[This message has been edited by maha anna (edited August 24, 2000).]
Jesse Tilly
Ranch Hand

Joined: Jun 25, 2000
Posts: 37
Can I make a suggestion? During development (and, as far as I'm concerned *always*) it is best to not have a system-wide CLASSPATH. My experience has proven that almost 70% of compile-time/run-time troubleshooting is CLASSPATH related. If you take full control of the classpath on the command line, you're one step closer to eliminating those pesky errors.
Jesse
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I have adopted a habit of writing a simple startup script for each of my applications. I call it 'go.bat' on Windows, or just 'go' on unix and it contains everything needed to start the application:- change working directory if necessary, set classpath or pass the classpath in on the command line, convert environment variables to Java system properties etc.
This works well, but you need to be aware of a few issues:
1. By default, batch files in Windows run in a stupid environment with not enough space to set environment variables. Right click on the batch file and set the environment space to (say)2048 or more.
2. Different versions of java can tequire slightly different parameters. The old "-classpath" argument has been replaced in many (but not all) newer JVMs by "-cp" which is really irritating. The DEC Unix Java 2 JVM I use at work allows a "-fast" argument which really does speed it up, but is not even compatible with older DEC Unix JVMs
3. Make sure to "chmod" unix shell scripts so they are executable by whoever needs to run them. If you are transferring scripts by FTP you may need to "chmod" every time you send a new version.
4. Make sure your scripts use the right type of end-of-lines. Java compilers usually accept both DOS (CR/LF) and UNix (LF) end of lines on all systems, but script files are not so forgiving.
5. Consider using "javaw" instead of just "java" on Windows, it can help prevent you getting an extraneous DOS window hanging around your desktop.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Please try setting the classpath in the window where you execute the compiler. Often times, the environment variable length exceeds the limit. So, please check whether your classpath contains the directory name before you start compiling.
If you are using WIN/95/98, you are most likely to end up with this problem.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks for the response, I got it working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Will not compile with javax.servlet.jsp
 
Similar Threads
Errors in compile jsp custom tag, please help
Unable to compile class for JSP
JspContext.getOut
custom tag
package javax.servlet.jsp.tagext does not exist error