• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem compiling classes from Head First book

 
Greenhorn
Posts: 12
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
MyExamCloud Support
Posts: 264
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic