| Author |
Head First Java (2nd Ed.) p. 112
|
marsooka
Greenhorn
Joined: Dec 31, 2006
Posts: 3
|
|
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 ]
|
 |
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8712
|
|
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
|
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
|
 |
Davy Kelly
Ranch Hand
Joined: Jan 12, 2004
Posts: 384
|
|
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 ]
|
How simple does it have to be???
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
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
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
marsooka
Greenhorn
Joined: Dec 31, 2006
Posts: 3
|
|
thanks... [ December 31, 2006: Message edited by: barclay mcdaniel ]
|
 |
 |
|
|
subject: Head First Java (2nd Ed.) p. 112
|
|
|