*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes About Running Assertion Programs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "About Running Assertion Programs" Watch "About Running Assertion Programs" New topic
Author

About Running Assertion Programs

Animesh Shrivastava
Ranch Hand

Joined: Jul 19, 2004
Posts: 298
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

Joined: Mar 13, 2004
Posts: 1272
try this:
java -ea MyClass


Mike Gershman
SCJP 1.4, SCWCD in process
Animesh Shrivastava
Ranch Hand

Joined: Jul 19, 2004
Posts: 298
Thats what,
i have tried
java -ea, but the option ea is not present and so its giving me error
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
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 ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
What do you get when you type:
java -version
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Hi Mike!
Animesh Shrivastava
Ranch Hand

Joined: Jul 19, 2004
Posts: 298
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

Joined: Jan 20, 2004
Posts: 82
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

Joined: Aug 03, 2002
Posts: 7729
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

Joined: Oct 12, 2000
Posts: 5093
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.


42
Animesh Shrivastava
Ranch Hand

Joined: Jul 19, 2004
Posts: 298
Thanks all of u,
Will try and let you know
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About Running Assertion Programs
 
Similar Threads
Assertions
ContextManager: Assertion failed: container==null (no Default Context?)
Assertion doubt
Assertion ?
Thread made out of Thread