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

  • Home
  • SEARCH
  • 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 8790299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:36:53+00:00 2026-06-13T22:36:53+00:00

public static void imRes(String pat) { try { BufferedImage bckimg = ImageIO.read(new File(c:/s/deneme.jpg)); File

  • 0
public static void imRes(String pat) {
        try {
            BufferedImage bckimg = ImageIO.read(new File("c:/s/deneme.jpg"));
            File s = new File(pat);
            BufferedImage im = ImageIO.read(s);
            BufferedImage im1 = resIm(im);
            BufferedImage finIm = mergIm(im1, bckimg);
            ImageIO.write(finIm, "jpg", new File("c:/s/deneme1.jpg"));
        } catch (IOException e) {

            e.printStackTrace();
        }

This is my first post, excuse me if I’ve done something wrong. This code was running properly untill i try to read an image from the source package. But now it can’t read any image. What am I doing wrong? Or is it something about eclipse?

Exception:

javax.imageio.IIOException: Can't read input file!
    at javax.imageio.ImageIO.read(Unknown Source)
    at imRe.imRes(imRe.java:12)
    at imReTest.main(imReTest.java:6)

Thanks…

  • 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-13T22:36:55+00:00Added an answer on June 13, 2026 at 10:36 pm

    Change / for \ if you are using windows.

    A more cross-platform approach would be substitute

    C: for File.listRoots()[0] and every / for File.separator.

    Read more on the File api documentation

    EDIT

    (I didn’t read this line, sorry)

    This code was running properly untill i try to read an image from the source package

    In order to get a file from inside your jar package, one must use the getClass().getResource() method.

    Example:

    application-package:
    |-Main.java
    |-resources
      |-image.jpg
    

    For the above directory structure:

    BufferedImage im = ImageIO.read(new File(getClass().getResource("/resources/image.jpg").toURI()));
    

    Would do the trick.

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

Sidebar

Related Questions

public static void main(String Data[]) { ConnectionPoolDataSource dps; try { cnt=new InitialContext(); cnt.rebind(java:comp/env/jdbc/pool/dragon, dps);
public static void main(String args[]) { Random r = new Random(); BufferedImage buf =
public static void main(String[] args) { staples[] stemp = new staples[8]; int j; try
public static void WriteLine(string text) { StreamWriter log; if (!File.Exists(Filename)) { log = new
public static void executeCommand(String cmd) { try { Process process = Runtime.getRuntime().exec(cmd, null, new
public static void parseProfilesJson(String the_json){ try { JSONObject myjson = new JSONObject(the_json); JSONArray nameArray
public static void Main() { Dictionary<string, double> values = new Dictionary<string, double>(); values.Add(a, 0.002);
public class Test { public static void main(String[] args) { DemoAbstractClass abstractClass = new
public class MultiplicationTable { public static void main (String[]a){ int[] x; x = new
public static void main (String args[]) { Scanner myinput=new Scanner(System.in) ; //Arrary length comes

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.