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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:29:15+00:00 2026-05-13T21:29:15+00:00

I am developing web method for webservice in java. In this web method I

  • 0

I am developing web method for webservice in java. In this web method I have to read image from my images folder which resides in my webservice project folder. I am using the code as follows.

@WebMethod(operationName = "getAddvertisementImage")
public Vector getAddvertisementImage()
{
    Image image = null;
    Vector imageList = new Vector();

    try
    {
     File file = new File("E:/SBTS/SBTSWebservice/web/adv_btm.jpg");
     image = ImageIO.read(file);
     imageList.add(image);
    }
  catch (IOException e)
  {
        e.printStackTrace();
  }
    return imageList;
}

I am unable to read image from images folder.I am getting error image file “input file can’t read” at image = ImageIO.read(file); how to resolve this issue ? Is there any mistake in my code or is there any other way to read image ? if there is any mistake in my code then can you proide me the code or link through which i can resolve the above issue.

  • 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-05-13T21:29:15+00:00Added an answer on May 13, 2026 at 9:29 pm

    Is the E:\ drive mapped on your web server? The Java compiler has no idea that you might access files outside of its scope and how it could tell your web server to map a network drive or a local hard disk which is attached to your development computer.

    The solution is to put the image file into the same directory as the Java source file and then use

    InputStream in = getClass().getResourceAsStream("adv_btm.jpg");
    

    Check that your IDE (or whatever you use to build your application) does copy the image file in the same directory where it creates the .class file. Then it should work.

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

Sidebar

Related Questions

I am using Apache CXF for developing Web services . I have a Webservice
I'm developing an axis java web service with two methods, both have an custom
I'm developing web-application, in this I want to add all months values on the
I'm developing web app using Spring Integration to route my messages, but I have
I've been developing web applications for 2 years now, and have been into simpler
We are developing web shops that are based on a lot of images. On
I am developing java web services (JAX-WS) to insert data into mysql DB and
I'm developing a java web service, with client certificate security enabled. I don't want
I am developing a web service from a WCF service application, and I run
I am developing an app which requires interaction with a SOAP web service, to

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.