This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Compiling in Terminal on MacOS High Sierra  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going through the first chapter of the OCA SE 8 book by Boyarsky and Selikoff. It suggests that I create 2 files in terminal and then compile and run the result.

ClassA.java:


ClassB.java:


The files are in /Users/me/tmp/packagea and /Users/me/tmp/packageb.
From the /Users/me/tmp directory I use

javac packagea/ClassA.java packageb/ClassB.java

to compile the code, and then

java packageb.ClassB

to run it.

All works well until I try to run the code, at which point I get:


Error: Could not find or load main class packageb.ClassB



Any ideas would be welcome. If I can't get through the first chapter I'm doomed!

 
Marshal
Posts: 64109
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Have you copied the code and instructions exactly? It says packageab in one place and packageb in the other.
 
Charles Cavin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell - thank you!

You have good eyes, while I, apparently, don't.


At least I know my system is working....
 
Campbell Ritchie
Marshal
Posts: 64109
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everybody makes that sort of mistake every now and again, and . . .
“That's a pleasure
 
Something about .... going for a swim. With this tiny ad ...
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!