package people;public class Person { public String name;
public int age;
public char sex; public void speeking(){
System.out.println("Hello ,everyone !");
}
}
============================================================package people.school;
import people.*;
public class Student extends Person{ public String stID;
public String major; public Student(String name,int age,char sex,String stID,String major){
this.name=name;
this.age=age;
this.sex=sex;
this.stID=stID;
this.major=major;
} public void speeking(){
super.speeking();
System.out.println("My name is "+name);
System.out.println("My age is "+age);
System.out.println("My sex is "+sex);
System.out.println("My stID is "+stID);
System.out.println("My major is "+major);
}
}
============================================================package people.school;
import people.*;
public class Teacher extends Person{ public String sch; public Teacher(String name,int age,char sex,String sch){
this.name=name;
this.age=age;
this.sex=sex;
this.sch=sch;
} public void speeking()
{
super.speeking();
System.out.println("My name is "+name);
System.out.println("My age is "+age);
System.out.println("My sex is "+sex);
System.out.println("I'm a teacher of "+sch);
}
}============================================================package people.school;import people.school.*;public class Test {
public static void main(String args[]){
Student s=new Student("Zhang san",19,'F',"091001","Computer&community");
Teacher t=new Teacher("Wang wu",30,'M',"Lanzhou University science & Technology");
s.speeking();
t.speeking();
}
} //JVM Launcher: Could not find the main class .Program will exit.
public int age;
public char sex; public void speeking(){
System.out.println("Hello ,everyone !");
}
}
============================================================package people.school;
import people.*;
public class Student extends Person{ public String stID;
public String major; public Student(String name,int age,char sex,String stID,String major){
this.name=name;
this.age=age;
this.sex=sex;
this.stID=stID;
this.major=major;
} public void speeking(){
super.speeking();
System.out.println("My name is "+name);
System.out.println("My age is "+age);
System.out.println("My sex is "+sex);
System.out.println("My stID is "+stID);
System.out.println("My major is "+major);
}
}
============================================================package people.school;
import people.*;
public class Teacher extends Person{ public String sch; public Teacher(String name,int age,char sex,String sch){
this.name=name;
this.age=age;
this.sex=sex;
this.sch=sch;
} public void speeking()
{
super.speeking();
System.out.println("My name is "+name);
System.out.println("My age is "+age);
System.out.println("My sex is "+sex);
System.out.println("I'm a teacher of "+sch);
}
}============================================================package people.school;import people.school.*;public class Test {
public static void main(String args[]){
Student s=new Student("Zhang san",19,'F',"091001","Computer&community");
Teacher t=new Teacher("Wang wu",30,'M',"Lanzhou University science & Technology");
s.speeking();
t.speeking();
}
} //JVM Launcher: Could not find the main class .Program will exit.
看你这个错误提示,应该是没有写主方法,程序找不到切入点,就是public static void main(String[] args){}这个方法
然后如果重新启动不管用
那就要看看你对eclipse的buildpath里面的配置了,一般你的class默认输出目录是bin,你看看bin文件夹是否生成了那些class文件
然后eclipse会重新编译你的程序, 当然你要确保你的project-->build automatially勾上。
这个问题的根本原因是,虽有java文件,但是没有编译成class,当然
//JVM Launcher: Could not find the main class .Program will exit.
如果是用jar直接运行出现这个错误,可能MF文件的问题,没有指定main方法。
其他的楼上的同志们说了一些。