• 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

Head First GoodDog code error

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I try to run this code from the book I get this error.

Here is my code

Here is the error

javac is not recogizable as an internal or external command, operable program or batch file.

funny I have compiled files from this same dir and computer just yesterday so I know the path is correct.

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you updated your Java version recently?

Java update can create new folders in the Java program directory for new versions. Such as "jdk1.6.0_25" folder inside the "Java" program folder.

Check in your system properties that your "path" and "classpath" variables, and the Java directory are pointing to the same folder.
 
Dustin Eldridge
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the funny part is I used javac on a old java file that I have already compiled and it worked today. So then I tried it on the GoodDog.java file and it came back with some errors in the code but it is working now. Dont have a clue what happened Friday because I have not changed anything. Oh well, thanks for your help.

Dustin
 
Dustin Eldridge
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this GoodDog code from HFJ book on page 82 really work?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code above won't compile because you forgot a " quote on line 17.

The error you had earlier ("javac is not recognized ...") doesn't have anything to do with the code. It just means that the operating system can't find the Java compiler, because your PATH environment variable isn't set up correctly.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic