• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with running a class that imports a custom package  RSS feed

 
Nick Neidig
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been unable to run the following class. I was able to compile Roma by entering javac mygame\partner\*.java at the command prompt.
package mygame.partner;
import mygame.client.Justy;
public class Roma extends Justy {
//main thread
}
Note: Justy is a public class and the error I keep getting at the command prompt is NoClassDefFoundError.
Thanks for your help
Nick
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a classpath problem. They give me fits, too. Your import required Justy.java or Justy.class to exist where the compiler could find it. Now you need Justy.class to exist where the JVM can find it. If it's in a jar add -cp to your command line: "java -cp path\that.jar etc,". If it's in a directory, it should be in "somedir\mygame\client\Justy.class". Make your -CP point to "java -cp path\somedir\".
If that doesn't help, ask again. Somebody with a better grasp on classpath issues will jump in. Good luck!
 
Nick Neidig
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your post Stan. I was not able to figure out how to get the Roma class to run. There is no directory before mygame on my computer. I have C:\mygame\client and C:\mygame\partner. Are mygame.client and mygame.partner appropriate package names? If you could show me exactly how to run Roma from the command prompt that would be extremely helpful.
I would greatly appreciate any further help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!