Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Head First Java - 2nd Ed. Pg 38 "The Guessing Game" question/ Atom Editor question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am a newbie and Java is my first language to try and learn thoroughly.

I am having an issue with "The Guessing Game" on page 38.

I understand this project is to make us visualize how the classes work together and using a test class, but they didn't label any of the files as a .java file??

I am using Atom Editor, (ALSO brand new to me but figured out how to get it to run correctly with path variables and added Kite!)

In order for the Atom Editor to run doesn't "GameLauncher.class" have to be GameLauncher.java, AND will Atom pull all the other classes (Player.class, GuessGame.class) as long as they are under the same folder in Atom?

I am not sure if this is more of an Atom Editor question or the need for the .java file. I guess I am just confused. I see how the classes all work together, but need to know how they all run smoothly in Atom.

TYIA
 
Marshal
Posts: 72946
330
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think, by the time they reached the guessing game, they took it for granted that you know you have to put the code into files called XYZ.java, and most of the time the file name has to match the class name. No, the XYZ.class doesn't have to be called YXZ.java. You need both, but it is possible to remove the XYZ.java file later. When the book was written, single file execution wasn't available, so you have to write the XYZ.java files and the javac tool (not the text editor) verifies the existence of the dependencies, e.g.  PQR.class files, and will create all the necessary Something.class files if necessary if all the Something.java files can be found.
I am not familiar with Atom. I am presuming it is a text editor rather than an IDE (=Integrated Development Environment); IDEs usually call javac etc. for you and relay any error messages, etc.
 
Adam LaFave
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I thought using Kite in Atom (which isn't available in Eclipse) would really help, but I found it to be more a nuisance.
Atom has a slew of separate packages and add-ons you can use and I had to add a java compiler, turns out I like Eclipse.

Back to Eclipse as my go to IDE. And it creates the .java files automatically WHEN YOU ADD a class to the project.

In Atom I had a mix-up as to how to name the files for some reason... and the book had labeled the classes as .class at the ending of each of the classes(when they are really .java files which I would've had to name them in my source folder as such, (but classes to the project). It all makes sense!

Putting all this where and what the compiler is actually pulling together.


Thanks for the reply!
 
Campbell Ritchie
Marshal
Posts: 72946
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a pleasure

There's nothing wrong with dropping tools if you don't find them helpful.
 
reply
    Bookmark Topic Watch Topic
  • New Topic