`
不爱不见
  • 浏览: 281439 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

eclipse解决editor does not contain a main type的方法 (转)

阅读更多
在前面的话:我的也出现这个问题,但是解决方法和转发的内容不太一样,原理一样,我是右击src--build path--use as source folder,估计以前是删除了工程中的部分东西,如果针对其他文件夹报错的会出现很多,不要担心,再remove source folder就行了,记得运行之后重启,还有包估计要重新rebuild source一下。



今天用eclipse,当打算run一个带有main函数的class时,出现editor does not contain a main type的错误框。

baidu了一下,迅速解决问题:原来这个class所在包没有被添加到build path中。

解决方法:在左侧的package explorer中右击这个class所在包的上一级目录--build path--use as source folder。这样就解决问题了。

重新打开class,再run一下,ok了。

-----------------------------------------------------
补充和解释:

哎,好吧。再稍微简单解释下。


看这张图,src就是在build path中的(仔细观察src的图标)
相对的,resource就只是个普通文件夹,而不在build path中(图标和src不一样吧?)
然后我又在resource下新建了文件夹和文件,比较下,包和文件夹的图标也是不一样的。

现在,我要把resource也加到build path中。(方法就是右击resource--build path--use as source folder)


这样,src和resource就都在build path中了。


最后,解释下,什么叫“在build path中”?你可以这么理解,eclipse中,在build path下的类可以被编译运行,在build path下的配置文件可以被类以相对路径直接读写。
分享到:
评论

相关推荐

    xcode报错SDK does not contain 'libarclite' at the path

    然而,开发者们时常会遇到各种各样的错误,其中“SDK does not contain 'libarclite' at the path”是一个常见的问题,主要与Apple的Automatic Reference Counting (ARC)机制有关。本文将深入探讨这个错误的原因、...

    SDK does not contain 'libarclite'

    标题中的问题"SDK does not contain 'libarclite'"指的是某个SDK缺少一个名为`libarclite`的库文件。这可能是一个错误或者是因为SDK未完整安装或配置不当导致的。 `libarclite`是一个特定的库,尤其在Android开发中...

    apache-maven-3.5.4

    - Check that Maven settings.xml does not contain http repositories - Check that Maven pom files do not contain http repository ----- - Check that Maven pom files do not contain http repository ----- -...

    xcode 15 找不到libarclite 等文件

    clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a'; try increasing the ...

    反编译工具ILSpy.exe

    ILSpy.exe是一款强大的开源反编译工具,专为.NET Framework和.NET Core应用程序设计。它允许开发者查看、理解和分析...通过ILSpycn,中文用户能够更方便地利用这个强大的工具,提升他们的开发效率和解决问题的能力。

    GEE错误-Dictionary does not contain key constant.pdf

    The error is " List (Error) Dictionary.getNumber: Dictionary does not contain key:constant." Would be generous to take some time out and help me correct the error? 我无法纠正代码中的错误。错误如下 ...

    libarclite-arc

    解决 Xcode 14.3,Xcode 15 旧项目可能报错 SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphone...

    关于eclipse发布web项目中遇到的问题

    解决这个问题的方法是,打开 eclipse 工作目录下的项目文件,进.settings 目录,打开org.eclipse.wst.common.project.facet.core.xml 文件,然后将 jst.web 的version 值改为 2.5(低版本)。 需要注意的是,在 ...

    空心J的java文件问题解决方法

    如果一个Java项目中的编辑器提示“does not contain a main type”或“selection does not contain a main type”,这通常意味着当前选中的文件或类没有包含正确的`main`方法。 #### 解决方法 1. **检查Main方法**...

    14.3(FromXcode_12.3_beta_xip).zip

    xcode真机调试文件14.3 DeviceSupport iOS 14.3 真机调试文件 位置/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport

    unity 可以使用的System.Drawing.dll

    System.Drawing.dll是.NET Framework的一部分,它提供了一系列类和方法,用于处理图像、图形、字体和颜色。这个库在Windows桌面应用开发中非常常见,但在Unity中使用时需要注意一些事项。 1. **引入System.Drawing....

    pdfbox最新版

    7. **PDF/A兼容性**:PDFBox还支持创建符合PDF/A标准的文档,这是一种用于长期保存的PDF格式,确保内容的可读性和持久性。 8. **OCR集成**:虽然PDFBox本身不包含OCR(光学字符识别)功能,但可以通过与其他OCR库如...

    protobuf-dt com.google.eclipse.protobuf_2.3.2.201609161849.jar

    it does not contain an entry for 'csharp_namespace' and lots of others. I'm using Eclipse Neon.3 (4.6.3). I did not manage to set/override the Options definition file either (I tried with and ...

    Safe Type-level Abstraction in Scala

    ### Safe Type-level Abstraction in Scala:深度解析与关键知识点 #### 概述 在软件工程领域,特别是面向对象编程(OOP)与函数式编程(FP)的融合中,Scala语言以其独特的特性脱颖而出,成为现代软件开发的重要...

    Android Studio配置本地SDK的方法

    问题一:Android Studio报错:SDK does not contain any platforms. 解决方法:本地SDK应放到名为platforms的外层文件夹内。 例子:D:\SDK\platforms… (选择路径时选取到SDK文件夹即可) 问题二:Android SDK ...

    I18N.CJK.dll,I18N.dll,I18N.West.dll

    在Unity中,用到MySql数据库时,发布exe 的时侯报错,有关于dll的错误,解决问题所需dll文件。 把unity文件夹下Unity\Editor\Data\Mono\lib\mono\2.0 中的 这三个dll放到项目plugins中就可以了。

    DTD(文档类型定义)

    **DTD(Document Type Definition,文档类型定义)**是一种用于验证 XML 文档结构的技术。它通过定义一组规则来确保 XML 文档中的元素、属性等按照既定的方式进行组织。DTD 的存在确保了 XML 文档的一致性和准确性。...

    com.sysdeo.eclipse.tomcat_3.2.1

    This plugin does not contain Tomcat. (Download and install Tomcat before using it) Download tomcatPluginV??.zip Unzip it in <eclipse_home>/plugins Plugin activation for Eclipse 3.x : - launch ...

    NGUI2.0插件

    NGUI2.0是NGUI的升级版本,它针对Unity3D平台进行了优化,提供了更高效、更灵活的UI解决方案。这个插件不仅包含了基本的界面元素,如按钮、文本、图片等,还提供了高级功能,如动态布局、粒子效果集成以及对触摸事件...

Global site tag (gtag.js) - Google Analytics