Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difficulty Running a Program that imports user-define package

 
Sandra Bachan
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

On Chapter 1 of Sierra/Bates, they give code snippits:

Saved in /one/src/Toon.java



Saved in /one/src/Cloo.java



Saved in /one/src/Roo.java




I am able to compile by going to the terminal, navigating to the one directory, and typing in

javac -d ./classes/ ./src/*.java

So how do I run Toon? Which directory do I go to so I don't get errors such as:

Exception in thread "main" java.lang.NoClassDefFoundError: Toon


 
Sandra Bachan
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bump

Any input?
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandra Bachan wrote:Bump

Please read this.

Since Toon class is not in any package, so you need to go into /one/classes directory and run the command java Toon . That should work...
 
Sandra Bachan
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome!

I appreciate the info provided in the link - usually this forum is very very responsive, hence anxious *BUMP*

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic