简体   繁体   中英

The import sun cannot be resolved

I have a little problem while compiling an Android application with Eclipse.

It says :

The import sun cannot be resolved

Actually I want to use the NotImplementedException Class from the package

sun.reflect.generics.reflectiveObjects

Do you have any ideas where it come from ?

I have Java 1.7 installed and Eclipse Indigo IDE for Java EE Developers.

The classes in sun.* are not meant to be imported . They are for internal use of the JVM only.

Use UnsupportedOperationException instead of NotImplementedException .

The sun.* packages are not part of the JDK but rather implementations in the Oracle JVM. As you are developing for Android (the dalvik JVM), those packages are not available. Simple as that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM