zoukankan      html  css  js  c++  java
  • Eclipse java上手

    一直都知道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

    这样继续运行,还是报错:“错误: 找不到或无法加载主类”,再加上以前模糊的记忆,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

  • 相关阅读:
    PHP线程安全和非线程安全有什么区别
    SHOW SLAVE STATUS 详解
    linux 2>&1
    crontab 例行性排程
    clang-format 数组初始化,多行模式
    windows 10 1909 无法启用 .NET Framework 解决
    SysCtlDelay 实现延时
    wpa_supplicant 检测错误密码
    swig python dynamic module does not define init function
    讯飞错误码10116
  • 原文地址:https://www.cnblogs.com/hahawgp/p/3875553.html
Copyright © 2011-2022 走看看