Java eclipse 看不到类文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19796148/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
eclipse doesn't see class file
提问by homeAccount
I have eclipse project.
我有日食项目。
I add directory src/directory
and put there SomeClass.java
我添加目录src/directory
并放在那里 SomeClass.java
I compile my application.
我编译我的应用程序。
in somedirectory
in filesystem I see .class
file.
在somedirectory
文件系统中我看到.class
文件。
But in eclipse somedirectory
looks empty.
但在 eclipse 中somedirectory
看起来是空的。
What the reason? How to fix it?
什么原因?如何解决?
I press F5 many times!
我多次按F5!
采纳答案by markusw
eclipse hides class files when you are in the package explorer. Try to switch to the navigator (Ctrl+3 and type "navigator") then a "bin" folder should appear and that one contains your class file.
当您在包浏览器中时,eclipse 会隐藏类文件。尝试切换到导航器(Ctrl+3 并键入“navigator”),然后会出现一个“bin”文件夹,其中包含您的类文件。
回答by Eng.Fouad
The hierarchy of the source directory src
, should be the same as the package name of the classes inside it. In other words, if you have a class whose package name is com.example.util
, then that class should be located inside the directory src/com/example/util
.
源目录的层次结构src
,应该与其中的类的包名相同。换句话说,如果您有一个包名为 的类com.example.util
,那么该类应该位于目录中src/com/example/util
。
回答by jlr
First, the Eclipse src
folder and output folder that will contain the compiled classes are two different folders. These two folders' location are configured in the Project's properties page, under the Java Build Pathtab. More information on the configuration can be found here.
首先,src
包含编译类的 Eclipse文件夹和输出文件夹是两个不同的文件夹。这两个文件夹的位置在项目的属性页面中配置,在Java Build Path选项卡下。可以在此处找到有关配置的更多信息。
So when you press in F5 in Eclipse to refresh the folder, you are basically refreshing the source folder, and you will never see the .class
file in there. The output folder that contains the .class
files are hidden by the Project Explorer view.
因此,当您在 Eclipse 中按 F5 刷新文件夹时,您基本上是在刷新源文件夹,并且您永远不会.class
在那里看到文件。包含.class
文件的输出文件夹被 Project Explorer 视图隐藏。
If you absolutely want to see these files via Eclipse, switch to the Resourceperspective and follow the instructions as given by the answer of this SO entryor rather follow instructions given by @markusw , CTRL-3 + Navigator view is way quicker!
如果您绝对想通过 Eclipse 查看这些文件,请切换到Resource透视图并按照此 SO 条目的答案给出的说明进行操作,或者按照 @markusw 给出的说明进行操作,CTRL-3 + Navigator 视图会更快!