eclipse中android运行main

来源:互联网 发布:淘宝中差评修改 编辑:程序博客网 时间:2024/06/06 12:21

今天突然发现一个问题,eclipse中写android的时候想测试一个方法,然后创建了个test的main文件去测试,结果发现运行不起来,一直报错:A fatal error has been detected by the Java Runtime Environment

然后查找原因,最后知道是因为这个类引用了android的包


解决:


右击有main方法的类


 Run as -> Run Configurations ->java application - 单击有main的类->选中classpath -> remove Bootstrap Entries下的android.jar

然后run就可以

1 0
原创粉丝点击