• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to turn on assert in TextPad ?

 
Kay Liew
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i enable assert for the following class in TextPad ? Trying to use the -ea -da , but i do not think that is suitable for TextPad.




Thanks,
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assertions are enabled with the "-ea" command when running the program from the Command Line. You do not enable assertions by modifying your source file (using TextPad).

For assertions to work, the file needs to be compiled with "-source 1.4" (without quotation marks) between the javac command and the file name.

By default, assertions are disabled when the program is run. To enable assertions, run the program with "-ea" (without quotation marks) between the java command and the file name.

Compiling with assertions:
javac - source 1.4 Filename.java

Running with assertions:
java -ea Filename
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Configure -> Preferences -> Tools -> Compile Java -> Parameters : -source 1.4 $File

Configure -> Preferences -> Tools -> Run Java -> Parameters : -ea $BaseName
[ October 06, 2004: Message edited by: Barry Gaunt ]
 
Kay Liew
Ranch Hand
Posts: 112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Barry, it works !!


Thank you both

k
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic