Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

could not find or load the main class  RSS feed

 
a k m shamsudoha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why find the problem when i try to run this code which is in d:\world directory and my package name is world
the problem is given below
C:\Documents and Settings\Administrator>D:

D:\>CD world

D:\world>set CLASSPATH=.;d:;

D:\world>javac HelloWorld.java

D:\world>java world.HelloWorld
Error: Could not find or load main class world.HelloWorld

my java code is given below

 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I have added code tags which you should always use, and you can see how much better your post looks
Don’t set a classpath for such a simple app. You can only find the class of that name from outside the world folder. Try
cd ..
java world.HelloWorld
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!