2

I have eclipse project.

I add directory src/directory and put there SomeClass.java

I compile my application.

in somedirectory in filesystem I see .class file.

But in eclipse somedirectory looks empty.

What the reason? How to fix it?

I press F5 many times!

homeAccount
  • 643
  • 2
  • 6
  • 13

3 Answers3

6

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.

markusw
  • 1,975
  • 16
  • 28
1

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 Path tab. More information on the configuration can be found here.

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.

If you absolutely want to see these files via Eclipse, switch to the Resource perspective and follow the instructions as given by the answer of this SO entry or rather follow instructions given by @markusw , CTRL-3 + Navigator view is way quicker!

Community
  • 1
  • 1
jlr
  • 1,362
  • 10
  • 17
0

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.

Eng.Fouad
  • 115,165
  • 71
  • 313
  • 417