将代码从JDK 1.5迁移到1.6时要遵循的步骤是什么?
遵循的步骤:
>将项目的构建补丁更改为JDK1.6
>将编译器更改为6
>清理并部署项目
>我收到编译错误
*** ERROR ***: Thu Apr 01 05:17:06 PDT 2010 org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml Stack trace of nested exception: java.lang.ClassCastException: org.eclipse.jst.javaee.web.internal.impl.WebAppDeploymentDescriptorImpl cannot be cast to org.eclipse.jst.j2ee.webapplication.WebApp at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl.loadDeploymentDescriptor(War22ImportStrategyImpl.java:87) at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.War22ImportStrategyImpl.importMetaData(War22ImportStrategyImpl.java:81) at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.WARFileImpl.getDeploymentDescriptor(WARFileImpl.java:145) *** ERROR ***: Thu Apr 01 05:17:06 PDT 2010 org.eclipse.wst.validation.internal.core.ValidationException: CHKJ3000E: WAR Validation Failed: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: WEB-INF/web.xml at org.eclipse.jst.j2ee.model.internal.validation.WarValidator.validateInJob(WarValidator.java:343) at org.eclipse.jst.j2ee.internal.web.validation.UIWarValidator.validateInJob(UIWarValidator.java:111) at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:75) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
解决方法
在绝大多数情况下,您根本不需要做任何事情.即使重新编译也不是绝对必要的.
JDK 6 Adoption Guide中记录了Java 5.0和6.0之间存在的一些不兼容性.