File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes how to set Eclipse don't build *.class file when errors exist? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "how to set Eclipse don Watch "how to set Eclipse don New topic
Author

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

lin playaoc
Greenhorn

Joined: Jul 12, 2010
Posts: 2
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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 ?


[My Blog]
All roads lead to JavaRanch
lin playaoc
Greenhorn

Joined: Jul 12, 2010
Posts: 2
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Nov 24, 2005
Posts: 14687
    
  16

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

Joined: Sep 29, 2008
Posts: 12617

Also interesting--thanks for the link.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to set Eclipse don't build *.class file when errors exist?