• Post Reply Bookmark Topic Watch Topic
  • New Topic

Could not find or load main class  RSS feed

 
Santosh Kumar Nayak
Ranch Hand
Posts: 153
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




I am getting could not find or load the main class. Can any one help me on this ?

 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36457
460
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What command are you using to run it?

Also, note that package names are lowercase in Java by convention. That's not your problem, but a good habit to get into.
 
Yusuf Husain
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Santosh Kumar Nayak wrote:



I am getting could not find or load the main class. Can any one help me on this ?



Hey there, it seems like the order of the code is the issue here, go ahead and try the code below:

public class myClass {

public static void main(String args[])
{

DispThread dt1= new DispThread("Hello");
DispThread dt2= new DispThread("World");
//
dt1.start();
dt2.start();
}

}

class DispThread extends Thread
{
String msg;

public void run()
{
for(int i=0;i<10;i++)
{
System.out.println("msg="+msg);
}}

DispThread (String m)
{
msg=m;
}
}


goodluck!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!