Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9062653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:47:30+00:00 2026-06-16T15:47:30+00:00

First, I want to mention that I read many stackoverflow posts about NoClassDefFoundError ,

  • 0

First, I want to mention that I read many stackoverflow posts about NoClassDefFoundError, and I also read about it in many other blogs and websites, but the solutions that people offered didn’t fix it.

I am running Eclipse 64-bit with the ADT plugin version v21.0.1-543035 on Ubuntu 12.10 64-bit. Everything is 64-bit, Ubuntu, Eclipse and the JRE and JDK that I use (jdk1.6.0_38).

I wrote a very small Android App that needs a class from the JDK to run.

I isolated the problem a little, and recreated it by creating a new “Android Application Project” with ONLY ONE LINE OF MY CODE (in the main class in the onCreate method). This line:

BufferedImage buff = new BufferedImage(100,100,BufferedImage.TYPE_INT_RGB);

Eclipse automatically adds the necessary import:

import java.awt.image.BufferedImage;

but asks that I add the jars/JRE for this class.

I added the jdk1.6.0_38 to Eclipse in “Installed JREs” (like they instruct on the Eclipse help pages).

In the project’s “Java Build Path” I added it through “Add library” -> “JRE system library” -> “Workspace default JRE”. It automatically added the JDK to the project’s build path.

During compile time, I get no errors. Only when running the application in the android emulator (any AVD) I get the following error:

E/dalvikvm(828): Could not find class 'java.awt.image.BufferedImage', referenced from method com.example.usejdk.MainActivity.onCreate
W/dalvikvm(828): VFY: unable to resolve new-instance 467 (Ljava/awt/image/BufferedImage;) in Lcom/example/usejdk/MainActivity;
D/dalvikvm(828): VFY: replacing opcode 0x22 at 0x0009
D/dalvikvm(828): DexOpt: unable to opt direct call 0x0cdc at 0x0c in Lcom/example/usejdk/MainActivity;.onCreate
D/AndroidRuntime(828): Shutting down VM
W/dalvikvm(828): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
E/AndroidRuntime(828): FATAL EXCEPTION: main
E/AndroidRuntime(828):   java.lang.NoClassDefFoundError: java.awt.image.BufferedImage
E/AndroidRuntime(828):   at com.example.usejdk.MainActivity.onCreate(MainActivity.java:16)
E/AndroidRuntime(828):   at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime(828):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime(828):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
E/AndroidRuntime(828):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
E/AndroidRuntime(828):   at android.app.ActivityThread.access$600(ActivityThread.java:141)
E/AndroidRuntime(828):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
E/AndroidRuntime(828):   at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(828):   at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(828):   at android.app.ActivityThread.main(ActivityThread.java:5039)
E/AndroidRuntime(828):   at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(828):   at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(828):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(828):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(828):   at dalvik.system.NativeStart.main(Native Method)

Here are the things I tried that didn’t work:

  1. adding to “eclipse.ini” the location of the jdk (“-vm
    /usr/lib/jvm/jdk1.6.0_38/bin” in 2 separate lines).
  2. I added the “Default VM Arguments” of the path “-Djava.library.path=/usr/lib/jvm/jdk1.6.0_38/jre/lib”.
  3. Using 32-bit JREs and JDKs and JRE/JDK7 – didn’t work (of course).
  4. I tried adding the jdk jar files manually to the “libs” folder and mark “add to buildpath” – didn’t work.
  5. I uninstalled and installed Eclipse again with the ADT and Android SDK…

Nothing fixes this annoying error…

Please, also notice these:

  1. I made sure my .classpath file contains the default JRE entry (like they say here)
  2. I tried adding other jar files to the “libs” folder + “add to path”, and using them – it worked fine.
  3. I tried running the same code (the one line) using the “import java.awt.image.BufferedImage;” in a regular java project (not an android project) and made the project “use Default JRE” – and it worked fine! Why does it work on a REGULAR Java project and not in an Android project?

I guess it means that my Eclipse installation does have the ability to use the jdk classes, but not in android applications.

So what do I have to do to make this single line of code run in an android application?

Any help would be VERY-VERY appreciated. Thanx in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:47:31+00:00Added an answer on June 16, 2026 at 3:47 pm

    So what do I have to do to make this single line of code run in an android application?

    The short answer is: nothing, because you can’t do anything about it. The whole java.awt.* framework isn’t part of the Android SDK, including BufferedImage, and hence not supported by the emulator or physical devices. Android has its own implementation for loading and rendering graphics.

    Without knowing what you need BufferedImage for, it’s hard to say what alternative you should be considering. Most likely you’re trying to do some sort of image manipulation that involves getting access to the individual pixels of an image? If that’s the case, have a look at the Bitmap and BitmapFactory classes.

    It all boils down to Java SDK != Android SDK. Anyways, also consider doing a search here on SO; you’re not the first one to make this mistake.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first of all i want to mention that there might not be any real
First of all I want to mention two things, One: My code isn't perfect
I have an object which I first want to rotate (about its own center)
First I want to clearify that I mean by reverse engineering something like decompiling
First I want to apologize for such a silly question but I'm quite new
I have a problem but first i want to know if im working on
I have read most posts re this issue, but still can't get my implementation
I have read a couple of posts for instance... http://blogs.msdn.com/b/adamroot/archive/2009/06/17/source-server-and-symbol-server-features-in-team-foundation-server-2010-beta-1.aspx http://blogs.msdn.com/b/jimlamb/archive/2009/06/15/symbol-and-source-server-in-tfs-2010.aspx From what I
I want to read a file into an ArrayList of Characters. At first I
I'd first like to mention that I'm not looking for an alternative method. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.