• 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 Java Ch. 2 Compile error

 
Greenhorn
Posts: 3
Mac OS X Chrome Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey i'm brand new to java and only done a little with programming in python so if you could help me out with this problem i would greatly appreciate it.
I am currently reading the Head First Java book and I am on chapter 2. I just got done writing up the GuessGame code. I have 3 files. I have my GuessGame.java, my Player.java, and my GameLauncher.java. I have also compiled the Player.java so i now have a Player.class file. What my problem is when i try to compile the GuessGame.java file.




now when i got to my command line and under the correct directory enter javac GuessGame.java i get this error


GuessGame.java:2:error: cannot find symbol
Player p1;
^
symbol: class Player
location: class GuessGame


then it does it 5 more time but instead of Player p1 it's Player p2, Player p3, p1 = new Player(); and p2 and p3. With the carrot underneath the P in Player. I will also add the player.java code too.




Thank you for your time and I would like to say this is a wonderful and helpful website.





Java-error.png
[Thumbnail for Java-error.png]
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.
Try compiling with javac *.java
 
Robert McMeekin
Greenhorn
Posts: 3
Mac OS X Chrome Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by compile with javac *.java?
If the * is suppose to be the file name then that is what i did if you look at the command line picture i uploaded. If there is any other code or anything you need to see let me know and i can upload it too. Thanks
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No I literally mean javac *.java
* is a wildcard which will compile all available .java files.
 
Robert McMeekin
Greenhorn
Posts: 3
Mac OS X Chrome Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow Thanks that worked! now that command compiles all the files in the current folder you are in then, correct? Once again truly appreciate it.
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic