Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

enableassertions

 
Balaji Bang
Ranch Hand
Posts: 182
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen enabling assertions at runtime :

java -ea

Can we enable asertions at compile time . if so is it the way???

javac -ea
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we enable asertions at compile time

What do you expect to happen ?
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to set it in an IDE, this might help.
 
Balaji Bang
Ranch Hand
Posts: 182
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am asking this question in Exam point of view.

How to enable assertions at compile time???

javac -ea (is this correct???)
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't enable or disable assertions at compile time. They are a runtime concept. Your assert code will get compiled always, you cannot skip it...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic