Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:
JavaWorld Daily Brew

cannot find file error while trying to complie a servlet


I have a class in C:\workspace\test\src\com\example\web\Test.java
I am trying to compile this servlet.
my javac is at C:\Sun\SDK\jdk\bin

i set the path like this set PATH=%PATH%;C:\Sun\SDK\jdk\bin

am at C:\workspace\test

I am compiling like this
javac -classpath /tomcat/common/lib/servlet-api.jar;classes:. -d classes src/com/example/web/example/web/Test.java

and i get cannot read:Test.java error

Please help

Your rating: None

I faced the same error

I faced the same error previosly, and it got resolved by re setting my system variables. My classpath was missing tools.jar present in lib directory of JDK . I added it to my classpath and bin folder of my JDK folder to my path and things worked fine.There is a : at the end of ur -classpath , don't know why , it should be semicolon. try setting the classpath before you do Javac.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <p> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br /> <br> <strike>
  • Lines and paragraphs break automatically.
  • Use <!--pagebreak--> to create page breaks.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
Just checking to see if you're an actual person rather than a spammer. Sorry for the inconvenience.