Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

About Running Assertion Programs

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written a assertion program, but i am unable to run it,
it compiled successfully when i gave the javac -source 1.4 ....
But for running the program i am not able to find ea or enableassertions option under java command,

Please anyone help me out

Thanks
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this:
java -ea MyClass
 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats what,
i have tried
java -ea, but the option ea is not present and so its giving me error
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does java -version print? It's possible you are picking up the wrong JRE. (In tat case you have to fix your %PATH% or $PATH variable)

And take a look at java -help.
[ January 16, 2005: Message edited by: Barry Gaunt ]
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you get when you type:
java -version
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike!
 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i do a java -version, i get java 1.3.1_01 and something related to Hotspot jvm and all
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assertions have been included only since Java 1.4
To use them you'll have to upgrade your JDK to 1.4 (I'd suggest 5.0, though).
Make sure your JAVA_HOME environmental variable points to your java_5.0 directory, and PATH environmental variable - to java_5.0/bin directory.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Animesh Shrivastava:
When i do a java -version, i get java 1.3.1_01 and something related to Hotspot jvm and all



So you were able to compile with javac -source 1.4 but java -version shows 1.3.1_01. So that implies that you have the directory containing the early version of the JRE in your PATH variable. So you will have to edit your PATH variable so that only the directory containing the binaries from JRE 1.4 can be found.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same when I first installed J2SDK 1.4.
The installer (in some builds at least, maybe in all) forgets to replace java and javaw in the Windows installation directory.
As the path to that takes precedense over anything you put on the path yourself the older java and javaw get taken instead of the newly installed ones even if your path settings are correct.
Remove java.exe and javaw.exe from your windows installation directories and everything is probably just AOK.
 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks all of u,
Will try and let you know
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic