我在
java中创建一个图像水印程序,我导入了以下内容:
import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGEncodeParam; import com.sun.image.codec.jpeg.JPEGImageEncoder;
但我收到一个错误,说:
Access restriction: The type
JPEGCodec
is not accesible due to restriction on required libraryC:\Program Files\Java\jre6\lib\rt.jar
解决方法
看看这里
Link
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.
正如米拉德所说
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)