无法在eclipse中导入java.awt.geom [英] can't import java.awt.geom in eclipse

查看:356
本文介绍了无法在eclipse中导入java.awt.geom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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中设置的JRE系统库中,通过执行以下操作,混淆了为什么会这样: Window> Preferences> Java> Installed JREs> Edit .. 。我看到我有 rt.jar ,当我找到磁盘上的jar并用 jar ft rt.jar 检查它的内容时,我看到它包含 java / awt / geom 类。

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中导入这个包?

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

谢谢

推荐答案

Android不会严格使用JRE库。其中一些是可用的,其中一些不是,这取决于Android SDK包括什么。 Android项目是针对Android SDK构建的(它看起来没有)。

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 SDK 的官方列表包括转到来源:Google,并选中参考标签为您正在构建的特定版本的Android。

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都使用了官方(或Open)JDK中的许多熟悉的东西,但它们在技术上是不一样的。

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为什么使用Java?解释说,源代码对于Android是Java(根据语言语法,结构等),但是当编译为字节码时,它不使用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.

这篇关于无法在eclipse中导入java.awt.geom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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