zcahfg2
zcahfg2

Reputation: 901

loading image asset folder in eclipse works fine but not on intelij

The image resources folder 'images' are imported and runs successfully on eclipse. But I have problem running this on IntelliJ.

Can someone enlighten me why it doesn't work on eclipse?

enter image description here

enter image description here Here I tried marking 'images' folder as Sources or resources but none of them works. It is currently not selected because if I select this then it overrides the .classpath file which is currently the same as the one in eclipse.

The image is imported using the following line:

imageMap = ImageIO.read(new File("images/map.png"));

Which works fine in eclipse.

So why does it not work in IntelliJ?

Many thanks in advance,

Upvotes: 0

Views: 177

Answers (1)

Meo
Meo

Reputation: 12521

Print new File("").getAbsolutePath() to see what your working directory is. You will then probably see that your relative path is wrong. You can change your Working directory in Run configuration.

Upvotes: 1

Related Questions