• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem compiling classes from Head First book  RSS feed

 
Ishitha Dyanil
Greenhorn
Posts: 12
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to servlets and I am learning servlets from Head First servlets and Jsp.
I am trying to compile BeerSelect.java file and It is giving error cannot find the BeerExpert.java. I followed total structure and set all the class paths.
I even followed the post in coderanch that some one asked before.I did everything.
I did try to complie the file from src directory and I also set the classpath for BeerExpert.java also.
here it is.

C:\Users\Krishna\Desktop\JAVA\beerV1\src>javac -classpath C:\Users\Krishna\Deskt
op\JAVA\Tomcat7\apache-tomcat-7.0.23\lib\servlet-api.jar;C:\Users\Krishna\Deskto
p\JAVA\beerV1\src\com\example\web\BeerExpert.class com\example\web\BeerSelect.ja
va

com\example\web\BeerSelect.java:3: error: cannot find symbol
import com.example.web.BeerExpert;
^
symbol: class BeerExpert
location: package com.example.web
com\example\web\BeerSelect.java:23: error: cannot find symbol
BeerExpert be=new BeerExpert();
^
symbol: class BeerExpert
location: class BeerSelect
com\example\web\BeerSelect.java:23: error: cannot find symbol
BeerExpert be=new BeerExpert();
^
symbol: class BeerExpert
location: class BeerSelect
3 errors

I put both files in same directory and I did everything.
BeerExpert.java compiles good but BeerSelect is not recognizing BeerExpert even though keeping in the same directory ..setting tha classpath...compiling from src...

please can any one help me on this..please..

Thanks!
 
Ganesan Ponnusamy
MyExamCloud Support
Ranch Hand
Posts: 264
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compile both the classes.

C:\Users\Krishna\Desktop\JAVA\beerV1\src>javac -classpath C:\Users\Krishna\Deskt
op\JAVA\Tomcat7\apache-tomcat-7.0.23\lib\servlet-api.jar;C:\Users\Krishna\Deskto
p\JAVA\beerV1\src\com\example\web\BeerExpert.class com\example\web\BeerExpert.ja
va com\example\web\BeerSelect.java

(or)

C:\Users\Krishna\Desktop\JAVA\beerV1\src>javac -classpath C:\Users\Krishna\Deskt
op\JAVA\Tomcat7\apache-tomcat-7.0.23\lib\servlet-api.jar;C:\Users\Krishna\Deskto
p\JAVA\beerV1\src\com\example\web\BeerExpert.class com\example\web\*.java
 
Ishitha Dyanil
Greenhorn
Posts: 12
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow...!!!
Amazing...It worked ..I set *.java It compiled and I can see BeerSelect.class in my folder...

Thank you so...much...

I want to know the reason..what is the reason it is taking all *.java ..but not simply..BeerSelect.java..
Can you please explain me.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!