Two Laptop Bag*
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 Android Security Essentials Live Lessons this week in the Android 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: 38100
    
  22
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: 38100
    
  22
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: 38100
    
  22
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?
 
jQuery in Action, 2nd edition
 
subject: Where to Enable the asserions
 
Similar Threads
Good Free Content Mgmt Tool
help required for assertion in java5
Using Assertion
asseertion
How to pass -source 1.4 argument in Eclipse