• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class in Eclipse won't go away...and now it doesn't compile

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't get Eclipse. First off, I created a class in Eclipse, but then shortly afterwards I deleted it, thinking I wouldn't need it. Now I think I want that class again (separate from an inner class), but everytime I try to create a new class with that name (even though I deleted both the .java and .class files), Eclipse says "Type Already Exists." I don't see how that's possible when I've deleted the .java and .class files. Can somebody help me with this.

...even better now. I must have hit somethign wrong, I think it was project-->clean. I thought that would clean up the problem I had above, but it didn't. Instead it deleted all my classes, but now when I hit run, Eclipse isn' compiling my .java files, and it just keeps saying "java.lang.NoClassDefFoundError:, Exception in Thread "main"" because it isn't compiling my files, that's why. Can somebody please help. Eclipse is so frustrating.
 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well now it seems like even though I explicitly set eclipse to build [the project] automatically it won't rebuild the project. If I make a change to my .java file, it will update the .java file but it won't re-run the compiler to compile that file. I don't understand why, I'm sure it's something I'm not doing, but I thought setting the project-->build automatically option would do it. Can somebody please help.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
delete the content of the bin folder for your project.
Most likely something was left behind there, and sometimes Eclipse isn't smart enough to clean up after itself.
 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I don't see a bin folder. The only things that I see that might relate to the project, within the folder my project is in, is .metadata, .settings, .classpath, and .project. None of which have content that looks like it refers to some missing class.

Can you confirm that bin folder? And also now, it won't even compile my code every time I click the run button. It just saves the .java file, but I guess deciding it doesn't feel like compiling as well.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try not to edit the .project or .classpath files directly. Unless you know what you're doing, you can get into big trouble. Normally Eclipse itself will handle those files.

Eclipse will hide your bin folder in the Java Perspective. The Java Perspective thinks that the only thing you're interested in is the source files. Switch to the Resource Perspective. It acts more like a traditional file explorer - it shows everything, including the .classpath and .project files.

If you still don't see your bin folder, bring up the Project Properties editor and look at the Java Build section. It should show what folder(s) it's using for source code and what folder(s) it compiles into.

If you have automatic builds turned on (the default), Eclipse will compile every time you save a Java file. Otherwise you can run the compile manually.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
or learn to use the rest of your computer, the part outside Eclipse
The bin folder is there, in your project directory (unless you explicitly told Eclipse to put it elsewhere), and named bin (unless you explicitly told Eclipse to name it differently).
 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So i started from scratch I started a new project. Created a /src folder in the main directory, and imported all my .java files into there. Now i wanted to do a little experiment. I didn't create any working sets, so in theory none of my files should be built when I hit run correct? But even though I have no working sets under Project->Working Sets, my code still compiles each time.

So I guess I'm not understanding what working sets really are, or how to control what gets compiled, or how to Eclipse to compile certain files. Can somebody explain?
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A working set is just a filter for the views into your workspace. It doesn't have any effect on what eclipse does, just on what you see.

Why don't you want Eclipse to compile all your files?
 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do want to use Eclipse to compile all my files, I'm just not sure why it doesn't. My files have never moved, and I didn't think I changed anything about where or which files to compiles, but Eclipse just kind of stopped compiling my files, and just running the files that were already compiled (or worst yet, if none were compiled, it just can't find the .class file).

Perhaps I changed where Eclipse thought my source files were, or perhaps I changed what Eclipse thought I should compile. Any idea where to do somethign like that?
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Wilson Mui:

Perhaps I changed where Eclipse thought my source files were, or perhaps I changed what Eclipse thought I should compile. Any idea where to do somethign like that?



Yes, in the project properties, under "Build Path", if I remember correctly.
 
A timing clock, fuse wire, high explosives and a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic