Code Migration from JDK 1.5 to 1.6
What are the steps to be followed for Migration 开发者_StackOverflowof code from JDK 1.5 to 1.6.
Steps followed :
- Changed the build Patch of Project as JDK1.6
- Changed the Compiler as 6
- Clean and deploy the Project
- I was getting Compilation error as
*** 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)
In the vast majority of cases, you don't need to do anything at all. Even recompiling is not strictly necessary.
The few incompatibilities that exist between Java 5.0 and 6.0 are documented in the JDK 6 Adoption Guide.
The code that ran on Java 1.5 will run on 1.6 without any modifications(in you weren't using any internal APIs that is). The public Java api is always forward compatible.
Recompile with new JDK, check warnings (maybe some of classes or methods are deprecated), check if application work as expected.
Download and install JDK 6. Update any environmental variables like JAVA_HOME, JDK_HOME. Make sure that your IDE points to the new library (most IDEs will do it automatically if restarted after the environmental variables have been updated). Update the project settings to use JDK 6 in your IDE for each project respectively.
That depends on your application I suppose here are the list of new features to 1.6 all your code however should work fine.
link java 1.6 features
I did following and it works fine
Changed the build Patch of Project as JDK1.6
Changed the Compiler as 6
I fixed a similar error by replacing:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
with:
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
When I did this replacement at web.xml, this CHKJ3000E has gone away.
精彩评论