• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Assertions related

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai ranchers
i am presenly using jdk 1.4.2_03.
Can anyone tell me how to compile and run programs?
thanks in advance.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

OK, in your version you can run programs with Assertions enabled.

For compiling your program to support "assert" as keyord, you can compile it as

CMD_Prompt>>javac -source 1.4 classname.java //this thing has been added in 1.4 only

for running the program you have to enable the assertion(by default it is disabled). You can enable that for your class as following.

CMD_Prompt>> java -ea classname

This is the most basic syntax for this command. There are various possibilities for enabling/disabling assertions for particular class, package, systemclass etc.

Hope it will help,

Regards,
Mausam
 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assertions are disabled by default. To compile with assertions enabled, you need to use the source 1.4 flag:

javac -source 1.4 Test.java

To enable assertions at runtime, use the -enableassertions or -ea flags.

For selective disabling of assertions at runtime, use the -da or -disableassertions flags.

For enabling assertions in the system classes, use the -esa or -dsa flags.
Assertions can also be enabled or disabled on a package basis.

Hope this will help
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ashok,


In General, Assertions are enabled only if you turn on it explicitly.By default they are not enable.

Use '-ea' to enable assertions.

Regards,
Venkat
 
achayya matta
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u very much guys
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic