wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes package not visible compile error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package not visible compile error" Watch "package not visible compile error" New topic
Author

package not visible compile error

rewati raman
Ranch Hand

Joined: May 22, 2010
Posts: 62
HI there i am trying to compile one servlet which is using a class in a package.
The class is already compiled but this servlet is not compiling
i have this file in com.example.web
and the BeerExpert in com.example.model
i checked there is no spelling error.
the exact error is below down the code




ERROR:



javac -classpath /home/rewati/Downloads/apache-tomcat-6.0.26/lib/servlet-api.jar:. -d classes src/com/example/web/BeerSelect.java
src/com/example/web/BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src/com/example/web/BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
3 errors


Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

Hi, You get this error because compiler can't get BeerExpert.class file. Make sure that you have BeerExpert.class file in com.example.model folder


Life is easy because we write the source code.....
rewati raman
Ranch Hand

Joined: May 22, 2010
Posts: 62
yeah its there.
I have checked it
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Rewati,
In future, while posting code, please UseCodeTags


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

make sure that you have compiled BeerExpert class with command. This will create BeerExpert.class file in a folder as you have mentioned the package statement. Then compile BeerSelect class with command
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

com.example.model, i.e. the src directory, needs to be in your classpath. Add it to your javac command.


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package not visible compile error