Eclipsejava上手-创新互联
一直都知道Eclipse作为java的IDE很强大,但是作为一个C/C++程序员都没用过Eclipse。这次正好有个需求搞文本检索,其中有一个牛B的开源软件lucene,正好是用java实现的,于是参考lucene的思想,实现一遍倒排索引,网上能看到的资源都是用java实现的,于是决定也用java实现,于是配置java环境变量,安装Eclipse,写第一个程序。写完程序点击那个绿色的运行按钮,直接报错:"Selection cannot be launched and there are no recent launches”,网上搜了下,发现第一次运行不能直接点这个,必须先设置一下run配置文件,即:Run-> Run Configurations...,可以参考:http://stackoverflow.com/questions/9240333/selection-cannot-be-launched-and-there-are-no-recent-launches-when-eclipse-for
网页标题:Eclipsejava上手-创新互联
网站路径:http://pwwzsj.com/article/dijise.html

这样继续运行,还是报错:“错误: 找不到或无法加载主类”,再加上以前模糊的记忆,java文件名必须和类名一致,于是修改文件名。继续还是报错,这个时候出现错误:“
editor does not contain a main type”,继续搜索,对于这个问题:原来这个class所在包没有被添加到build path中。
解决方法:在左侧的package explorer中右击这个class所在包的上一级目录--build path--use as source folder。这样就解决问题了。
重新打开class,再run一下,ok了。
应该算是第一次搞Eclipse java了!mark
网页标题:Eclipsejava上手-创新互联
网站路径:http://pwwzsj.com/article/dijise.html