Results 1 to 2 of 2
  1. #1
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    3

    Default Loading files(namely images)

    Hey, whenever i have an application that loads files, which are images in most cases, I always end up having to use the complete path in order to load them. Why?
    e.g:
    Java Code:
    ("C:\\blah\\blah\\...etc")
    This is inconvenient.
    Also, i usually use:
    Java Code:
    ImageIO.read(new File("C:\\..."))
    I find that whenever i just place the filename there or one folder the image is never found. This may be related to where java looks for my image and to add to that, the image is always in the same folder as all the class files and in eclispe it looks like:
    Java Code:
    \workspace\AppName\bin\appname\
    Some help would be appreciated.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Another approach is to make them resources of your application which you can load from the classpath.
    See Smartly load your properties - JavaWorld for how to do it

Similar Threads

  1. Loading images from an Array
    By pinkette in forum New To Java
    Replies: 5
    Last Post: 04-15-2011, 11:37 AM
  2. Loading large images in JavaME
    By b12 in forum Advanced Java
    Replies: 1
    Last Post: 04-01-2009, 11:02 AM
  3. Loading images in seperate packages?
    By Bibendum in forum New To Java
    Replies: 0
    Last Post: 03-02-2008, 10:43 PM
  4. Loading Images - Imp
    By Thulasiraman in forum Advanced Java
    Replies: 0
    Last Post: 01-28-2008, 09:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •