• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't find package  RSS feed

 
Aaron de Souza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm working through Head First Servlets & JSP and I've come across a problem when I try to compile a class.

The command I'm trying to compile the class with is

F:\Head First Servlets\beerV1>javac -classpath "c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar";classes:. -d classes src\com\example\web\BeerSelect.java

and the error I am getting is

src\com\example\web\BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src\com\example\web\BeerSelect.java:13: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src\com\example\web\BeerSelect.java:13: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
3 errors

F:\Head First Servlets\beerV1>

The BeerExpert.class is located in F:\Head First Servlets\beerV1\classes\com\example\model\BeerExpert.class

Not sure what I'm doing wrong, hope someone can help...

Aaron
 
nek thomas
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would recommend inorder to avoid such error, you should directly go to the package from windows....and do javac classnane.java



Nek
 
Jason Irwin
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the obvious answer is that your classpath is wrong, the compiler simply cannot find "BeerExpert". I think it's "classes:." that is the problem.

Try:
javac -classpath "c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar";.\classes -d classes src\com\example\web\BeerSelect.java

You will be able to compile from that location once you have your classpath correct.

Like the project name....
 
Campbell Ritchie
Sheriff
Posts: 55366
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We usually discuss servlets and JSP elsewhere. Moving thread.
If you look through our FAQ pages and look for JSP and servlets, you may find something there to help you.
 
Aaron de Souza
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jason Irwin wrote:Well, the obvious answer is that your classpath is wrong, the compiler simply cannot find "BeerExpert". I think it's "classes:." that is the problem.

Try:
javac -classpath "c:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar";.\classes -d classes src\com\example\web\BeerSelect.java

You will be able to compile from that location once you have your classpath correct.

Like the project name....


Doh! Thanks Jason, the problem was with "classes:." it should have been "classes;."

Aaron
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!