I get a "Can't read input file error" ONLY when program is run through terminal or run on another computer?
<p>I have a Java program which I currently working on in IntelliJ. The program loads a bunch of images on startup reading from a folder "images" located in the project folder. It works fine when I run it through my IDE, but if I try to run the program through my Terminal OR on another computer the startup images won't load and I get an IO-error "can't read input file" and none of the startup images which are to be displayed on the JPanel on startup are shown.</p>

<p>I am guessing this has something to do with the access to the directory of the project folder only working in my IDE but not in my Terminal or Command prompt (tried both OS X and Windows) and certainly not on another computer altogether.</p>

<p>Say I want to give my whole project folder to another user on another computer, how would I make it so that the images will load regardless of where the project folder is located? I mean the images for loading are located in the project folder, so they are there it's just the terminal / other computer can't find it?</p>

<p>Do I need to add something to the code in order for the project folder to be found through Terminal or through another computer?</p>

<p>These are the images I am getting:</p>

<pre><code>    initialImages[0] = new Image(0, 100, "images/dog.gif");
    initialImages[1] = new Image(100, 100, "images/cat.gif");
</code></pre>

<p>So by just writing "images/" + the name of the picture I get inside the images folder inside my project folder. But how can I make this work on another computer or when I compile my project through the Terminal? Whenever I run it like that the program can't understand "images/" somehow. It's like it only knows where the project folder is if I run it through my IDE on my computer.</p>

<p>When I am creating a new file I use</p>

<pre><code> this.image = ImageIO.read(new File(String.valueOf(filepath)));
</code></pre>

<p>where "filepath" represents for example "images/dog.gif".</p>