Q:

Using links in different folders for images (Java)

I'm designing a calculator with customised buttons. Naturally I want to organise my image files in folders different to the package interfaces.
The location of the folders is interfaces/Seven/seven-normal.png but whenever I don't include the full link 
    "C:\Liloka\Source\interfaces\Seven\seven-normal.png" 

it doesn't work and everything disappears. I swear I have seen this being done in normal code.  If I used this in proper programs I can't expect people to be changing the link to where they've put the code! Here's the code I've been using:
    seven = new ButtonImage("/Seven/seven-normal.png"); - Doesn't work
    nine = new ButtonImage("C:/Users/Liloka/workspace/WebsiteContent/src/interfaces/Nine/nine-normal.png"); - Does work

Thanks!

A:

"/Seven/seven-normal.png"

...is a path to C:\Seven\seven-normal.png - because of the / at the very beginning of your path, which essentially means, from the root of the drive, go to the "Seven" folder, and then load "seven-normal.png"
You have to use a relative path, something like, "../../interfaces/Seven/seven-normal.png" or maybe just "interfaces/Seven/seven-normal.png"
The first path will take you "up" two folders, and then down to interfaces/Seven/seven-normal.png. Essentially, you have to figure out what folder your code is running under, also called the "working directory", and construct a relative path from there.

