• Post Reply Bookmark Topic Watch Topic
  • New Topic

running java program from command line  RSS feed

 
trupti nigam
Ranch Hand
Posts: 640
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

When I run my java class from withing the editor , it runs fine. But I am trying to run it from command line and I get the noClassDef found error.

I searched on google, and I think I am doing everything right.
My java class is located at c:\package1\package2\package3\package4\package5\package6\package7

I am running the java <classname> command from package7 level.
Both the java and .class files are located in same directory.

The classpath has current directory i.e..;

What am I doing wrong?

Thanks,
Trupti
 
Joe Ess
Bartender
Posts: 9439
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an advanced question?
It sounds like you are running your class correctly if you declared it to be in the default package (i.e. you have no "package" declaration in your .java file). If you do have a package definition in your class, you need to run Java from the root of the package structure (given your current classpath).
How Classes Are Found
The Java Tutorial: Packages
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!