为什么 RAD 会在 IOException(ex); 上抛出编译错误
为什么 RAD7 给出的编译错误为
构造函数 IOException(Exception) 未定义
构造函数 IOException(Exception)在以下行中
throw new IOException(ex);
Javadoc for Java 1.6/6.0 声明 IOException
有一个 IOException(Throwable)
构造函数
当我查看 IOException
的定义时我只看到以下构造函数
IOException()
IOException(String)
注释:
- Rational Application Developer 7.0.0.8
- 项目兼容性设置为 Java 6
Why does RAD7 give a compile error of
The constructor IOException(Exception) is undefined
on the following line
throw new IOException(ex);
The Javadoc for Java 1.6/6.0 states that IOException
has a IOException(Throwable)
constructor
When I look at the definition of IOException
I see only the following constructors
IOException()
IOException(String)
Notes:
- Rational Application Developer 7.0.0.8
- Project Compatability set to Java 6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是由于您的项目被设置为针对较旧的 JRE 进行编译而导致的。
如果这是一个“faceted 项目”(右键单击项目 -> 属性,选择“Project Facets”(如果存在)),那么您的“Java”facet 可能不是 1.6。
如果这不是一个“多面项目”,请转到该项目的构建路径,您将看到它正在针对 WAS 6.0 JRE(即 JDK 1.4)进行编译。双击它更改为 WAS 7.0 JRE。
This is caused by your project being set to compile against an older JRE.
If this is a "faceted project" (right-click the project -> properties, choose "Project Facets" if it exists), then your "Java" facet is probably not 1.6.
If this is not a "faceted project", go to the project's build-path and you'll see that it's compiling against a WAS 6.0 JRE which is JDK 1.4. Double-click it to change to WAS 7.0 JRE.