Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Head First Java (2nd Ed.) p. 112

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The instructions on page 112 are to "Drop all three classes(...) into the same directory...
my question is based on the fact that the only successful class/java-file i compiled was the one called GameHelper. What is the exact syntax and file name(s) of the other two supposed to be, i've tried many and continue to get compile errors...
the other two (saved in one .java file together, or two separate .java files) are referred to as SimpleDotCom and SimpleDotComGame.

thanks, marsooka
[ December 31, 2006: Message edited by: barclay mcdaniel ]
 
author
Posts: 9034
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Barclay,

Can you tell us a little more about exactly what files you have (their exact names), what directory(ies) they are in, what compiler command you're using, and exactly what errors you're getting?

Thanks!

Bert
 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think what they are trying to say is that the 3 classes should be in the same directory e.g. C:\Program Files\Java\jdk1.5.0_03 so that you can compile and run them you only compile the SimpleDotComTestDrive file and the rest should compile automatically

then run it.

so to re-iterate, have all 3 java files in a directory typically, where the bin file is.

save all 3 files with their Class_Name.java, here is the code:




compile "javac SimpleDotComTestDrive.java" this will in turn compile the rest, then run it java SimpleDotComTestDrive this should run all 3 classes as the game.

davy
[ December 31, 2006: Message edited by: Davy Kelly ]
 
author & internet detective
Posts: 41073
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Barclay,
Yes, each (public) class should be in a separate file. When you compile them, be sure to compile in one step so all the classes are found.

>javac *.java
 
marsooka
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks...
[ December 31, 2006: Message edited by: barclay mcdaniel ]
 
It's never done THAT before. Explain it to me tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic