Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Will not compile with javax.servlet.jsp

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1467
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response, I got it working.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic