简体   繁体   English

Eclipse 没有在新建项目向导中创建新的 .java 文件?

[英]Eclipse not creating new .java file in New Project wizard?

OK, I have a really basic (read stupid) question.好的,我有一个非常基本的(读起来很愚蠢)问题。 I am just beginning Java programming, and am using Eclipse 3.7.2.我刚刚开始 Java 编程,并且正在使用 Eclipse 3.7.2。 I have done a few beginning projects without any problems.我已经做了一些没有任何问题的开始项目。 All of a sudden, when I create a new project using the wizard, it is not creating the src/.java file.突然之间,当我使用向导创建一个新项目时,它并没有创建 src/.java 文件。 When I try to manually add it after creating the project, I end up getting some cryptic error messages.当我在创建项目后尝试手动添加它时,我最终会收到一些神秘的错误消息。

  1. I have re-followed several walk-throughs on project creation for clues as to any option I may have accidentally un-checked and no luck.我已经重新跟踪了几个关于项目创建的演练,以寻找关于我可能不小心取消选中并且没有运气的任何选项的线索。
  2. Googling the answer brings up results for more advanced problems that are unrelated.谷歌搜索答案会为不相关的更高级问题带来结果。
  3. I have combed the preferences, but nothing looks obvious, and我已经梳理了偏好,但看起来没有什么明显的,并且
  4. I have gone hunting for any user app data I could delete to force a clean slate.我已经开始寻找我可以删除的任何用户应用程序数据以强制清空。
  5. I have even created a new instance of Eclipse to a different directory and still have the same result.我什至在不同的目录中创建了一个新的 Eclipse 实例,但结果仍然相同。
  6. My son's instance, which is on the same computer still creates the .java file from the wizard.我儿子的实例在同一台计算机上仍然从向导创建 .java 文件。 The only difference is that my instances have the Android SDK installed (I am trying to create basic Java projects and not Android projects).唯一的区别是我的实例安装了 Android SDK(我正在尝试创建基本的 Java 项目而不是 Android 项目)。

I am at a loss, and have lost a lot of time trying to correct the situation.我很茫然,并且已经浪费了很多时间试图纠正这种情况。 What do I need to do to reenable the creation of a src/.java file in Eclipse?我需要做什么才能在 Eclipse 中重新启用 src/.java 文件的创建?

Screenshots (click on image for full size):截图(点击图片查看大图):

在此处输入图像描述 在此处输入图像描述

Make sure you are choosing a java project from the right folder in the wizard.确保您从向导中的正确文件夹中选择了一个 java 项目。 It sounds like it is creating an android java project, which is probably why your src folder is missing.听起来它正在创建一个 android java 项目,这可能是您的 src 文件夹丢失的原因。 See if there is a helloworld project under example projects too in the wizard, that may get you started too.查看向导中的示例项目下是否也有一个 helloworld 项目,这也可以帮助您入门。 Screenshot may help us.屏幕截图可能对我们有所帮助。 I want to see which project type you choose and which folder it is in.我想看看您选择的项目类型以及它所在的文件夹。

How about changing eclipse to point to a new workspace.如何将 eclipse 更改为指向新的工作区。 That may drop the android settings.这可能会删除android设置。 Under the file menu, choose switch workspace and pick a new location.在文件菜单下,选择切换工作区并选择一个新位置。 Thats most likely why a new install did not fix it.这很可能是新安装无法修复它的原因。 That workspace may have android settings in it, so change to a new folder somewhere else to test it like c:\workspace2\该工作区中可能包含 android 设置,因此请更改为其他地方的新文件夹以对其进行测试,例如 c:\workspace2\

Here's a good tutorial I found that may help too.这是我发现的一个很好的教程,它也可能有所帮助。

eclipse java project tutorial eclipse java项目教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM