Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to create image.

 
Vijendra Babar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friend,

Following is my machine environment:
JDK: 1.5
Struts: 2.0
Tomcat: 5.5
OS: Linux

I want to create a thumbnail from image. Entire logic for it is clear. I have runned same application on Windows platform, it is working fine & gives no error.
But of the application is deployed on Linux platform, it throws exception.

Following is the logic:

1. I create a file object with string input containing path.
2. I have taken another varible of BufferedImage
Code :

BufferedImage image = ImageIO.read(imageFile);

While creating this ojbect it gives me Exception as

javax.imageio.IIOException: Can't read input file!

Since file is created, there is not problem in path.
Then why is it giving me exception, instead it gives prefect output on windows platform.

Can any one sort out this problem.
 
Dom Lassy
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the string input you are using to create the file object?

You should not use any "/" or "\" characters for the path. You need to use File.separator instead.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, make sure that you are not including a drive letter such as "c:\" in your path. There is no such thing as a drive letter in LINUX.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic