• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Running Assertion Programs

 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • 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
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this:
java -ea MyClass
 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • 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
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Hi Mike!
 
Animesh Shrivastava
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • 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
 
Andris Jekabsons
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks all of u,
Will try and let you know
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic