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 8194367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:48:00+00:00 2026-06-07T04:48:00+00:00

I am new to Java and are trying to display an image. I got

  • 0

I am new to Java and are trying to display an image. I got code on the net but when trying it I get an error with the importing of ” import javax.imageio.ImageIO;” The error message reads “javax.imageio.ImageIO” is either a misplace package name or a non-existing entity.
I have seen this on many samples but it does not work with me.
Is there any advice

mport java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
public class Showmap extends Panel
{
    BufferedImage img;
    public Showmap ()
    {
        try
        {
            image = ImageIO.read (new File ("KNP.jpg"));
        }


        /*
           catch (IOException e)
           {









               BufferedImage  image;
                 public ShowImage() {
                 try {
                 System.out.println("Enter image name\n");
                 BufferedReader bf=new BufferedReader(new
               InputStreamReader(System.in));
                String imageName=bf.readLine();
                 File input = new File(imageName);
                 image = ImageIO.read(input);
           }*/


        catch (IOException e)
        {
            System.out.println ("Error:" + e.getMessage ());
        }
    }


    public void paint (Graphics g)
    {
        g.drawImage (image, 0, 0, null);
    }



    static public void main (String args []) throws
        Exception
    {
        JFrame frame = new JFrame ("Display image");
        Panel panel = new Showmap ();
        frame.getContentPane ().add (panel);
        frame.setSize (500, 500);
        frame.setVisible (true);
    }
}

Thanks
Ivan

  • 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-07T04:48:04+00:00Added an answer on June 7, 2026 at 4:48 am

    I was programming with “Ready to Program” and tried many options with out success. When I copied the same code to “JCreator” and run it fro there it was working fine. Seems “import javax.imageio.ImageIO;” is not working with “Ready to Program”.

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

Sidebar

Related Questions

I am trying simple java applet program to display tiff image as below import
I'm trying to build a simple HTTP Server using Java, using java.net.ServerSocket = new
trying to learn windows programming in java, want to display a image to a
Greetings! I've been trying to display some HTML with Java using JEditorPane . But
I'm trying to display a JTextArea within a JScrollPane, but I just get an
Im trying to display an image upon clicking a JButton but upon execution the
I'm new at java and OpenGL. I'm trying to get a camera preview screen
I am new to Java and trying to do a simple program to help
Just a warning: I'm completely new to Java and am trying to teach myself
I'm new to java and I'm trying to swap out the text on a

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.