This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Head First GoodDog code error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First GoodDog code error" Watch "Head First GoodDog code error" New topic

Head First GoodDog code error

Dustin Eldridge

Joined: Feb 04, 2008
Posts: 20
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.

Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
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

Joined: Feb 04, 2008
Posts: 20
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 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 Eldridge

Joined: Feb 04, 2008
Posts: 20
Does this GoodDog code from HFJ book on page 82 really work?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Don't get me started about those stupid light bulbs.
subject: Head First GoodDog code error
Similar Threads
Quick question about instance variables
Two classes defined in the same source file ??
return values in methods
working with book, code compiiles but won't run
Doubt about private modifier