• Post Reply Bookmark Topic Watch Topic
  • New Topic

Relative path setting issue  RSS feed

 
Sam Saha
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a simple java file name ImageTest.java file in this folder below

Classes/com/simple/ruff/test/ImageTest.java

And I have an image test.jpg in this folder below

Classes/com/simple/Images/test.jpg

I am reading the test.jpg from the ImageTest.java. But I am getting error message as below in the console

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



I would really appreciate if someone can suggest me the way to resolve this issue. Thank you very much.
 
Jarrod Rackley
Ranch Hand
Posts: 30
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about getting the file as an input stream and read that for the image.



Then just read the BufferedInputStream



This should find and load it if the resource is under the src folder.

 
Sam Saha
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That worked!!! Thank you very much for your expert suggestion.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!