Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Can't find package

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
Marshal
Posts: 73953
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic