*
The moose likes Servlets and the fly likes cannot compile servlet code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "cannot compile servlet code" Watch "cannot compile servlet code" New topic
Author

cannot compile servlet code

northfield Sid
Ranch Hand

Joined: Aug 08, 2002
Posts: 106
I cannot compile Servlet files on my WinXP environment.
my servlet.jar file is located at
c:\tomcat\jakarta-tomcat-3.3.1\common\lib\servlet.jar
what shall I do?
The error messages are only for servlet portion of code?
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
did you point your classpath to 'c:\tomcat\jakarta-tomcat-3.3.1\common\lib\servlet.jar' ?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12789
    
    5
I have taken the plunge and gone entirely to using ANT when compiling servlets and any other applications that requires more than the standard library. ANT makes it so easy to create those special classpaths and you don't have to screw up your environment variables. It also makes it easy to switch back and forth between versions of libraries.
Yes ANT has a learning curve, but you will be glad you did. Many open source projects just routinely include ANT build.xml files.
Bill
northfield Sid
Ranch Hand

Joined: Aug 08, 2002
Posts: 106
In XP you can set the path by rightclicking on my computer - then go to environment vairables and edit the path but I cannot see any for classpath???
What is the easist way yo use the class path?
----------------------------------------------
Thanks Brogdan,
I want to read ANT, but as you said there is a learning curve, so I think I will do in a months time.
Philip Shanks
Ranch Hand

Joined: Oct 15, 2002
Posts: 189
I see this "classpath" solution offered up quite frequently, but to be honest, I've never set a CLASSPATH environment variable on any windoze machine that I have used, and I don't have any problems compiling. I do set JAVA_HOME to point to the J2SDK install directory, which I always put on a partition root, with no spaces in the folder name.
Could you describe your environment in a bit more detail?
Are you compiling from the command line?
If so, did you add a copy of servlet.jar to %JAVA_HOME%\jre\lib\ext\ ?
If not, are you using the proper command line flags and arguments to specify classpath and target directory, etc?
Are you compiling from within another Java environment, say perhaps jEdit or Netbeans?
If jEdit, did you set the classpath in the editor config?
If you're using Netbeans, then you shouldn't be having any problems with this... suggest re-installing Netbeans.
PCS
[ November 08, 2002: Message edited by: Philip Shanks ]

Philip Shanks, SCJP - Castro Valley, CA
My boss never outsources or has lay-offs, and He's always hiring. I work for Jesus! Prepare your resume!
northfield Sid
Ranch Hand

Joined: Aug 08, 2002
Posts: 106
>Are you compiling from the command line?
Yes.
>If so, did you add a copy of servlet.jar to %JAVA_HOME%\jre\lib\ext\ ?
No, but I have now, and it works.
I have in previous occasions installed classpath but on latest installations have not since I was advised by many from the forum not to.
Thanks
I will also be hopefully be learning ANT very soon.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot compile servlet code