import com.sun.image.codec.jpeg。* [英] import com.sun.image.codec.jpeg.*

查看:432
本文介绍了import com.sun.image.codec.jpeg。*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编译时有一个Java程序
我得到以下错误

I have a Java program when I compile it I get the following error

[javac] ...\MyClass.java:33: package com.sun.image.codec.jpeg does not exist
[javac] import com.sun.image.codec.jpeg.*;
[javac] ^

我该怎么办?

现在不推荐使用com.sun软件包,编写映像文件的正确方法是什么。

What is the correct way of writing an image file now that the com.sun package is deprecated.

推荐答案

为什么要在包 com.sun.image.codec.jpeg 中使用类?您不应该直接使用这些类:为什么开发人员不应该写调用'sun'套餐的程序

Why are you using classes in the package com.sun.image.codec.jpeg? You are not supposed to use those classes directly: Why Developers Should Not Write Programs That Call 'sun' Packages.

您的计划有何功能?它只是尝试读取或写入JPG图像吗?使用 ImageIO API非常容易。请参阅本教程:编写/保存图像

What does your program do? Does it just try to read or write a JPG image? That's very easy with the ImageIO API. See this tutorial: Writing/Saving an Image.

添加 - 已删除包 com.sun.image.codec.jpeg 在Java 7中提到的 Java SE 7和JDK 7兼容性指南

Addition - The package com.sun.image.codec.jpeg has been removed in Java 7 as mentioned in the Java SE 7 and JDK 7 Compatibility Guide.


概要:非标准 com.sun.image。 codec.jpeg 包已退役

描述: com.sun.image。 codec.jpeg 包是在JDK 1.2(1998年12月)中添加的,作为控制JPEG格式图像文件加载和保存的非标准方法。该软件包从未成为平台规范的一部分,已从Java SE 7版本中删除。 Java Image I / O API作为标准API添加到JDK 1.4版本中,无需使用 com.sun.image.codec.jpeg 包。

Description: The com.sun.image.codec.jpeg package was added in JDK 1.2 (Dec 1998) as a non-standard way of controlling the loading and saving of JPEG format image files. This package was never part of the platform specification and it has been removed from the Java SE 7 release. The Java Image I/O API was added to the JDK 1.4 release as a standard API and eliminated the need for the com.sun.image.codec.jpeg package.

这篇关于import com.sun.image.codec.jpeg。*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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