我正在为Eclipse写序列化代码,我试图将FileOutputStream与try-with-resource一起使用,但是我收到一条错误消息:“此处不允许低于1.7的源级别的资源规范”作为修复,Eclipse将显示消息“将项目合规性和JRE更改为1.7”。对我来说这是一个新错误,请帮助。
public static void main(String[] args) {
Employee employeeOut = null;
try(FileOutputStream fos = new FileOutputStream("Employee.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos) ){
}
}
我想编译此类。