• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package not visible compile error

 
rewati raman
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
rewati raman
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah its there.
I have checked it
 
Maneesh Godbole
Saloon Keeper
Posts: 11177
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rewati,
In future, while posting code, please UseCodeTags
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
com.example.model, i.e. the src directory, needs to be in your classpath. Add it to your javac command.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic