wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Where to Enable the asserions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Where to Enable the asserions" Watch "Where to Enable the asserions" New topic
Author

Where to Enable the asserions

harbir hundal
Greenhorn

Joined: May 07, 2011
Posts: 14

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

Joined: Oct 13, 2005
Posts: 39396
    
  28
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

Joined: Oct 13, 2005
Posts: 39396
    
  28
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

Joined: May 07, 2011
Posts: 14

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

Joined: Oct 13, 2005
Posts: 39396
    
  28
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where to Enable the asserions