我需要什么库,所以我可以在Java中访问这个com.sun.image.codec.jpeg? [英] what library I need so I can access this com.sun.image.codec.jpeg in Java?

查看:107
本文介绍了我需要什么库,所以我可以在Java中访问这个com.sun.image.codec.jpeg?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在java中创建一个图像水印程序,我导入了以下内容:

I'm creating an image watermarking program in java and I imported the followings:

import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGEncodeParam;
import com.sun.image.codec.jpeg.JPEGImageEncoder;

但我收到错误消息:

访问限制:由于对所需库的限制 C:\Program Files \\,因此无法访问 JPEGCodec 类型\\ java\jre6 \lib\rt.jar

Access restriction: The type JPEGCodec is not accesible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar

有人知道解决方法吗?这个,或者我应该添加哪些库才能访问它以及我找到该库的位置?

Does someone know a way to solve this, or what library should I add in order to access that and where I find that library?

推荐答案

看看这里< a href =http://forums.dzone.com/eclipse/384-access-restriction-problems.html\"rel =noreferrer>链接

1. Open project properties.
2. Select Java Build Path node.
3. Select Libraries tab.
4. Remove JRE System Library.
5. Add Library JRE System Library.

作为 Milad 建议


即使这可行,但这违反了所有推荐的Java运行时策略。最佳做法是避免使用rt.jar(或任何其他Sun提供的运行时库,如tools.jar)

Even though this WILL work, this goes against all recommended Java Runtime policies. The best practice is to avoid using rt.jar (or any other Sun supplied runtime library for that matter, like tools.jar)

这篇关于我需要什么库,所以我可以在Java中访问这个com.sun.image.codec.jpeg?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆