• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where to Enable the asserions

 
harbir hundal
Greenhorn
Posts: 14
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am a junior developer and developing a web application using Eclipse and the server is JBOSS 6.

I want to know how and where to enable the "assertion", so I can put assertions in my code, and there be the Assertion Errors while developing and testing.

I want to know if I have to do some configuration in Jboss, or some other place.

Any sort of help leading int he right direction will be really appreciated.

Regards
Adofo
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know about JBoss.
campbell@queeg:~/java/rubbish$ java KettleDemo
A Kettle, size 20 containing 10 of water.
A Kettle, size . . .
campbell@queeg:~/java/rubbish$ java -ea KettleDemo
A Kettle, size 20 containing 10 of water.
A Kettle, size . . .
I have deleted part of the output; you can copy and paste those classes and execute them and see what really happens.

Note the -ea option. That is the crucial bit. There are other options for assertions.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I earlier wrote:. . . There are other options for assertions.
You will find a complete list of options for the "java" tool here.
 
harbir hundal
Greenhorn
Posts: 14
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thank you for your reply Campbell.
I can actually enable the assertion in the java application with the option -ea.
In fact, for eclipse we just need to put "-ea" the JVM variable and the asserions will be turned on for application.

I want to know how can I use assertions in context to web application, that is being deployed in Jboss.
(I should have been more clear)

Regards
Adofo
 
Campbell Ritchie
Sheriff
Pie
Posts: 50277
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You use assertions to check the classes for errors before trying to run your application. Do you need assertions when you have got the whole application?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic