• 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.

  • 相关阅读:
    将一堆图片自适应页面排列
    用正则匹配富文本中的文本,并替换其内容
    实战
    从 defineProperty 到 Proxy
    CSS 实现蜂巢/六边形图集
    Umi 小白纪实(三)—— 震惊!路由竟然如此强大!
    无题
    贺文
    模型可解释性方法--lime
    多模态融合注记
  • 原文地址:https://www.cnblogs.com/carol-wei/p/7836712.html
Copyright © 2020-2023  润新知