zoukankan      html  css  js  c++  java
  • MAC & Eclipse运行java程序报错:Could not find or load main class

    参看: https://stackoverflow.com/questions/11235827/eclipse-error-could-not-find-or-load-main-class

    If you create a java class with public static void main(String[] args), Eclipse will run that main method for you by right clicking on the file itself, or on the file in the project explorer, then choosing:

    "Run As" -> "Java Application."

    Once you do this, Eclipse stores information about your class, so you can easily run the class again from the Run As menu (Green Play Button on the toolbar) or from the Run Configurations dialog.

    If you subsequently MOVE the java class (manually, or however), then again choose 

    "Run As" -> "Java Application,"

    from the new location, Eclipse will run the original stored configuration, attempt to invoke this class from its original location, which causes this error.

    For me, the fix was to go to the run configurations, (Green Play Button -> Run Configurations) and remove all references to the class. The next time you run 

    "Run As" -> "Java Application" 

    Eclipse will write a new configuration for the moved class, and the error will go away.

  • 相关阅读:
    稀疏矩阵解题数学库 -- UMFPACK
    国外程序猿整理的C++大全
    SQL实用语句大全
    this 三句话
    ELK 7.4.2 单机安装配置
    简单搭建DNS服务器——bind
    关于博客皮肤
    Golang 实现 array_push
    Golang 发送POST请求,加header头,带参数
    Golang 签名
  • 原文地址:https://www.cnblogs.com/carol-wei/p/7836712.html
Copyright © 2011-2022 走看看