The following error is preventing my project from running:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
assert cannot be resolved to a type
Syntax error on token ".", ; expected
The method holdsLock(Logging[]) is undefined for the type Logging
at org.geotools.util.logging.Logging.getLogging(Logging.java:183)
at org.geotools.util.logging.Logging.getLogging(Logging.java:170)
at org.geotools.util.logging.Logging.<clinit>(Logging.java:78)
at myproject.RasterTest.<init>(RasterTest.java:57)
at myproject.RasterTest.main(RasterTest.java:318)`
The logging tool needed from the geotools
library has many assert
statements within the classes which eclipse does not recognise.
I have seen a few similar problems on SO which suggested entering the string -ea
into
Windows -> Preferences -> Java -> Installed JREs -> jdk1.7.0_51 -> Edit -> Default VM Arguments
, but I did that to no avail.
The line which throws the error:
public class RasterTest extends ViewPart {
...
protected final Logger LOGGER =
org.geotools.util.logging.Logging.getLogger("org.geotools.factory");
...
}
I found a solution:
Instead of entering the string -ea
into
Windows -> Preferences -> Java -> Installed JREs -> jdk1.7.0_51 -> Edit -> Default VM Arguments
I entered the string -ea
into
Right Click on ProjectName in Project Window -> Run as -> Run Configurations -> ProjectName.product -> Arguments -> Default VM Arguments
.
If anyone knows why the second works, but not the first, I'd love to know why.