Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't import java.awt.geom in eclipse

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).

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.

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

Thanks

like image 920
noobler Avatar asked Oct 28 '11 01:10

noobler


1 Answers

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.

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.

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.

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.

like image 189
jefflunt Avatar answered Sep 30 '22 07:09

jefflunt