• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems from the command line  RSS feed

 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I built an app using an IDE but it must be executable from the command line. The app users packages/sub folders to keep my work organized (I don't know if that is an important element or not).

I can run it fine in the IDE (Eclipse) but not from the command line. This is what I am getting:

C:\Program Files\Java\DominoGame>dir
Volume in drive C has no label.
Volume Serial Number is D4CC-B637

Directory of C:\Program Files\Java\DominoGame

11/29/2006 07:41 AM <DIR> .
11/29/2006 07:41 AM <DIR> ..
11/15/2006 10:44 AM 226 .classpath
11/15/2006 10:44 AM 386 .project
11/29/2006 07:41 AM <DIR> ai
11/29/2006 07:54 AM <DIR> game
11/29/2006 07:41 AM <DIR> gamePiece
11/29/2006 07:41 AM <DIR> gui
11/29/2006 07:41 AM <DIR> test
2 File(s) 612 bytes
7 Dir(s) 45,629,513,728 bytes free

C:\Program Files\Java\DominoGame>cd game

C:\Program Files\Java\DominoGame\game>java Dominos
Exception in thread "main" java.lang.NoClassDefFoundError: Dominos

C:\Program Files\Java\DominoGame\game>java Dominos
Exception in thread "main" java.lang.NoClassDefFoundError: Dominos

C:\Program Files\Java\DominoGame\game>

What am I doing wrong?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a package statement in Domonos.java? Set things up so the package name matches the directory paths from current directory to the class file, then give the path to the class file on the command line. I'm guessing it might be like:

package game;
class Domino ...

cd DominosGame
java game\Domino

See Setting the Classpath that has more detail than I want to reproduce here. And see if THIS helps.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!