不能导入java.awt。几何学在eclipse中

时间:2023-01-17 17:05:30

I just started working on a new Eclipse Android project and want to make use of classes in the java.awt.geom package. I have OpenJVM 1.6 AND sun 1.6 jdk installed, both from debian's repositories. When I try to import the package, it says that the import cannot be resolved (in fact, Eclipse's auto-complete only shows awt and awt.font).

我刚刚开始开发一个新的Eclipse Android项目,并希望在java.awt中使用类。几何学包。我安装了OpenJVM 1.6和sun 1.6 jdk,都来自debian的存储库。当我尝试导入包时,它说无法解析导入(实际上,Eclipse的自动完成只显示awt和awt.font)。

I am beyond confused as to why this is, as I looked at the JRE system libraries set up in my Eclipse by doing: Window > Preferences > Java > Installed JREs > Edit... and I see that I have rt.jar included, and when I locate the jar on disk and examine it's contents with jar ft rt.jar, I see that it contains java/awt/geom classes.

当我查看Eclipse中设置的JRE系统库时,我不知道为什么会这样做:Window >偏好> Java >安装了JREs >编辑…我看到包含rt.jar,当我在磁盘上找到jar并检查它与jar ft rt.jar的内容时,我看到它包含java/awt/geom类。

Does anybody know why I can't import this package in Eclipse?

有人知道为什么我不能在Eclipse中导入这个包吗?

Thanks

谢谢

1 个解决方案

#1


7  

Android doesn't strictly use the JRE libraries. Some of them are available and some of them aren't, depending on what the Android SDK includes. Android projects are built against the Android SDK, which (as it appears) doesn't have that library.

Android并不严格使用JRE库。有些是可用的,有些不是,这取决于Android SDK包含的内容。Android项目是在Android SDK的基础上构建的,Android SDK(看起来)没有这个库。

For the official list of what the Android SDK does include, go to the source: Google, and checkout the "Reference" tab for the specific version of Android you're building against.

对于Android SDK所包含的正式列表,请访问源代码:谷歌,并为您正在构建的特定版本的Android签出“Reference”选项卡。

This causes some confusion, I know. While much of the Android SDK uses many of the familiar things from the official (or Open) JDK, they're technically not the same.

我知道这会引起一些混乱。虽然Android SDK使用了许多来自官方(或开放)JDK的熟悉内容,但它们在技术上并不相同。

Also, one of the answers to Why does Android use Java? explains that the source code for Android is Java (in terms of the language syntax, structure, etc.), but when compiled to bytecode, it doesn't use the JDK.

还有,为什么Android要使用Java?解释说,Android的源代码是Java(在语言语法、结构等方面),但是编译为字节码时,它不使用JDK。

#1


7  

Android doesn't strictly use the JRE libraries. Some of them are available and some of them aren't, depending on what the Android SDK includes. Android projects are built against the Android SDK, which (as it appears) doesn't have that library.

Android并不严格使用JRE库。有些是可用的,有些不是,这取决于Android SDK包含的内容。Android项目是在Android SDK的基础上构建的,Android SDK(看起来)没有这个库。

For the official list of what the Android SDK does include, go to the source: Google, and checkout the "Reference" tab for the specific version of Android you're building against.

对于Android SDK所包含的正式列表,请访问源代码:谷歌,并为您正在构建的特定版本的Android签出“Reference”选项卡。

This causes some confusion, I know. While much of the Android SDK uses many of the familiar things from the official (or Open) JDK, they're technically not the same.

我知道这会引起一些混乱。虽然Android SDK使用了许多来自官方(或开放)JDK的熟悉内容,但它们在技术上并不相同。

Also, one of the answers to Why does Android use Java? explains that the source code for Android is Java (in terms of the language syntax, structure, etc.), but when compiled to bytecode, it doesn't use the JDK.

还有,为什么Android要使用Java?解释说,Android的源代码是Java(在语言语法、结构等方面),但是编译为字节码时,它不使用JDK。