四时宝库

程序员的知识宝库

程序包com.sun.image.codec.jpeg不存在 问题的完美解决

1、问题项目打包报错;



程序包com.sun.image.codec.jpeg不存在;

2、原因

src/test/*.java中的类编译时找不到包。

3、解决方案

通过配置maven-compiler-plugin插件可以解决此问题。


<compilerArguments>

<verbose />

<bootclasspath>${java.home}\lib\rt.jar;${java.home}\lib\jce.jar</bootclasspath>

</compilerArguments>


再次编译成功。

这个类文件的位置在jre/lib/rt.jar

原因是由于编译的依赖JDK版本过高引起的。从JDK1.7开始,中com.sun.image.codec.jpeg这个类被删除,所以编译总是报错,解决方案,编译的JDK版本设置为JDK1.6或者以下版本,编译通过。

原因是由于编译的依赖JDK版本过高引起的。从JDK1.7开始,中com.sun.image.codec.jpeg这个类被删除,所以编译总是报错,解决方案,编译的JDK版本设置为JDK1.6或者以下版本,编译通过。

<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>

发表评论:

控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言
    友情链接