Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot compile a file in WindowsXP

 
kenneth See
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can anybody help me in pointing out the problems of the following command line in compiling a file?

javac -classpath "C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar":classes:. -d classes "D:\Study\SCWCD Exam\MyProjects\beerV1\src\com\example\web\BeerSelect.java"

In my BeerSelect.java, I have the followings :
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
......

I have tried to compile this file several times but Compiler always complaint:
package javax.servlet does not exist
package javax.servlet.http does not exist

However, I have checked the servlet-api.jar, it has those two packages.

Thanks for all your help!!

Kenneth
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the Java compiler to be able to compile Servlets, you need to add the servlet jar files to your Java class path.
 
cesar valencia
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bosun Bello:
For the Java compiler to be able to compile Servlets, you need to add the servlet jar files to your Java class path.


he did, he just did it wrong.


keeneth, in windows you must use ";" instead of ":" as the separator in the classpath.

try again like this:
javac -classpath "C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar";classes;. -d classes "D:\Study\SCWCD Exam\MyProjects\beerV1\src\com\example\web\BeerSelect.java"

also, i would advice against compiling from that path, you'll do better with something like:
"cd \Study\SCWCD Exam\MyProjects\beerV1\" and then "javac -classpath C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar;classes;. -d classes src\com\example\web\BeerSelect.java"
 
kenneth See
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

Thanks for your reminder. It works now by using ";" instead of ":".

Kenneth
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic