Login  Register

Re: Assertions

Posted by Burger Wilhelm on Mar 24, 2010; 9:25pm
URL: http://imagej.273.s1.nabble.com/Assertions-tp3688810p3688814.html

David,

you need to set the -ea flag when you start ImageJ (Java VM). Compile-and-Run does not stop/start the JVM. For example, on my WinXP/Sun-JVM system I simply changed the file ImageJ.cfg to:

.
jre\bin\javaw.exe
-ea -Xmx594m -cp ij.jar ij.ImageJ

Here is an example:
//---------------------------------------------------
import ij.IJ;
import ij.plugin.PlugIn;

public class JavaCheckAssertions implements PlugIn {
 public void run(String arg0) {
  assert false : "YES, assertions are activated!";
  IJ.log("Assertions are turned OFF (use -ea switch to start IJ)");
 }
}
//---------------------------------------------------

Works fine here.
--Wilhelm
________________________________________
From: ImageJ Interest Group [[hidden email]] On Behalf Of David Webster [[hidden email]]
Sent: Wednesday, March 24, 2010 18:37
To: [hidden email]
Subject: Re: Assertions

But how do I do this when using ImageJ's 'Compile and Run"?

David

On Wed, Mar 24, 2010 at 12:35 AM, Burger Wilhelm <
[hidden email]> wrote:

> Use the -ea flag when launching the Java runtime.
>
> --Wilhelm
>
>
>