Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to set Eclipse don't build *.class file when errors exist?

 
lin playaoc
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Eclipse version is 3.5(jee-galileo).
if it's possible to set someting.
then the .class file will not build when there are some error or Exceptions.?
Because sometimes i will confuse if the class is fine or not.
very thanks.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Class files are not generated for classes having compiling errors. If you have an old class file, it won't be deleted though. But I don't see where the problem is. If you can't compile, it's not even worth looking at the class file. Do you have a more specific problem ?
 
lin playaoc
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem maybe due to Eclipse....
such as my code: it has an exception, test is not reasonable.
when I save the file,(My project set Build Automatically).and the *.class file will be builded.
I hope not to build this class,it will confuse me.and the class should be empty.


the decompiled builded *.classes
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope not to build this class,it will confuse me.

Why does it confuse you ? Why are you looking at the class file ? I'm not sure that you can configure this behaviour in Eclipse.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting; I didn't know it did that, although I guess when I think about it I *have* seen it, and it makes sense.

I also can't think of a reason why it *shouldn't* do that, or why you're looking for the presence of a particular class file a evidence of project compilation success--wouldn't it make more sense to look in the IDE, the mechanism by which you're building it?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David wrote:Interesting; I didn't know it did that

I didn't either. I never look at the classes directory. If there are compilation errors, I see them in the Problems view, I see them in the Package Explorer.

After googling, I found some information here. It looks like it's the default behaviour since Eclipse 3.4.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also interesting--thanks for the link.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic