记录一下myeclipse在jdk7 下面使用buildWar打包jdk6的项目程序包com.sun.image.codec.jpeg不存在

公司的老项目用的jdk6  我本地用jdk7 跑项目 但是用buildWar 打war包一直报错

7: 错误: 程序包com.sun.image.codec.jpeg不存在
    [javac] import com.sun.image.codec.jpeg.*;
    [javac] ^

 

解决方法:

因为jdk7中没有com.sun.image.codec.jpeg这个程序包了。

如果是maven 管理的那么加上

<plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                    <optimize>true</optimize>  
                    <debug>true</debug>  
                    <showDeprecation>true</showDeprecation>  
                    <showWarnings>false</showWarnings>
                    <compilerArguments>
                        <verbose />
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>
如果用的不是maven 管理的话 可以将jre6 中的 C:\Program Files\Java\jre6\lib  目录下面的 rt.jar 复制出来放在webbapp 下面的lib 目录下

记录一下myeclipse在jdk7 下面使用buildWar打包jdk6的项目程序包com.sun.image.codec.jpeg不存在