简体   繁体   English

断言无法解析为类型-RCP开发人员的Eclipse Helios

[英]Assert cannot be resolved to a type - Eclipse Helios for RCP Developers

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. geotools库所需的日志记录工具在eclipse无法识别的类中具有许多assert语句。

I have seen a few similar problems on SO which suggested entering the string -ea into 我在SO上看到了一些类似的问题,建议将字符串-ea输入
Windows -> Preferences -> Java -> Installed JREs -> jdk1.7.0_51 -> Edit -> Default VM Arguments , but I did that to no avail. Windows -> Preferences -> Java -> Installed JREs -> jdk1.7.0_51 -> Edit -> Default VM Arguments ,但是我没有用。


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 而不是在Windows -> Preferences -> Java -> Installed JREs -> jdk1.7.0_51 -> Edit -> Default VM Arguments中输入字符串-ea 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 . Right Click on ProjectName in Project Window -> Run as -> Run Configurations -> ProjectName.product -> Arguments -> Default VM Arguments输入了字符串-ea

If anyone knows why the second works, but not the first, I'd love to know why. 如果有人知道第二个为什么有效,而第一个为什么无效,我很想知道为什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM