如何避免没有主类和没有类def找到错误使用DropBox和Eclipse for Java [英] How to avoid no main class and no class def found error using DropBox and Eclipse for Java

查看:267
本文介绍了如何避免没有主类和没有类def找到错误使用DropBox和Eclipse for Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse编写Java代码,并使用DropBox将我的代码与他人的程序同步到我们的多台计算机上。大多数时候,一切都按预期方式工作:如果任何人在任何一方进行更改,更改将被保存,而另一个人刷新Eclipse工作区时,更改将通过并可以被成功查看并运行。

I use Eclipse to write Java code and use DropBox to sync my code with others' across our multiple computers. Most of the time, everything works as expected: if anyone makes a change on either end, the change is saved and when the other person refreshes the Eclipse workspace, the changes come through and can be viewed and run successfully.

有时,出现了几个错误之一。有时候,Eclipse说它找不到一个主类,有时它表示它找不到类本身。有时它不会报告错误,但由于某种原因,即使编译器显示新的源代码并保存,也不会实际更新.class文件,因此运行旧版本。我注意到,如果我手动将代码复制到文件系统其他地方的新的.java文件,然后编译它,它的工作正常,但由于某种原因,它拒绝重新生成.class文件,我必须删除它手动将其替换为在另一个项目中生成的那个 - 然后它工作。但是为了解决其他问题,需要手动复制,删除和重新粘贴....

Sometimes, one of several errors arises. Sometimes Eclipse says it cannot find a main class and sometimes it says it could not find the class itself. Sometimes it will not report an error but for some reason will not actually update the .class file and therefore run an old version even though the compiler displays the new source code and that saves. I've then noticed that if I manually copy the code into a new .java file elsewhere in the file system and then compile it, it works fine, but for some reason it refuses to regenerate the .class file and I have to delete it manually and replace it with the one generated in the other project--then it works. But for solving the other problems everything needs to be manually copied, deleted, and re-pasted....

实际错误包括NoClassDefFoundError,UnsupportedClassVersionError和其他一些错误相关的没有一个主类。]

[The actual errors include NoClassDefFoundError, UnsupportedClassVersionError, and some other error related to not having a main class.]

我意识到这里的描述有点模糊,但不幸的是,我不完全确定发生了什么。我希望我只是想念一些基本的事实,有助于解决所有这些问题。

I realize that the description here is somewhat vague, but unfortunately I'm not entirely sure what's going on. I hope I'm just missing some basic fact that would help solve all these problems.

谢谢!

推荐答案

我相信您会看到使用Dropbox分享您的来源的问题。

I'm sure you will see issues using Dropbox for sharing your source.

Eclipse不知道Dropbox在上传和下载更新时正在做什么,他们的活动肯定不会被同步。在Eclipse尝试构建等等的任意时间点,它会发现意外的活动,甚至可能部分下载的源文件,可能会解释您看到的具体错误。

Eclipse does not know what Dropbox is doing whilst it's uploading and downloading updates and their activities will certainly not be synchronised. At arbitrary points in time when Eclipse tries to do builds etc. it will find unexpected activity going on, maybe even partially downloaded source files which might explain the specific errors you are seeing.

您正在尝试比分享照片或文档更复杂的事情。我会给出的建议是使用像git或subversion这样的源代码控制系统来进行源代码共享和控制。然后,您可以使用Eclipse插件,旨在以易于使用的方式集成这些系统。这里有一个学习曲线,但技能将为您服务。

You're trying to do something more complex than sharing photos or documents. The advice I would give is to use a source control system like git or subversion for source code sharing and control. You can then make use of plugins for Eclipse that are designed to integrate these systems in an easy to use way. There's a learning curve there, but the skills will serve you well.

您可以使用这些解决方案的在线版本,如 github unfuddle 如果要使用共享,备份和源代码作为一个服务的版本控制,就像您对Dropbox一样。他们也是免费的。

You can use online versions of these solutions like github and unfuddle if you want to consume sharing, backup and version control of source as a service like you do with Dropbox. They're free, too.

这篇关于如何避免没有主类和没有类def找到错误使用DropBox和Eclipse for Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆