Marc H
Marc H

Reputation: 1248

import images into an intelliJ Java project

I am working on a Java project that requires the use of several images. I'm on ubuntu linux So I have an images folder inside my src directory. So far so good but try as I might I can't seem to find a way to load or import image files into that images folder. ( I want to be able to simply go something like loadImage("images/imageToLoad.png"); )

I have tried to just drag and drop. I know that I could of course leave the program and use the linux filesystem to transfer the images but that's a pain and defeats the purpose of an IDE.

Upvotes: 6

Views: 19060

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 401945

You will have to do it in a file manager, outside of IntelliJ IDEA. To ensure that images are available in the application classpath check Settings | Compiler | Resource Patterns, .png extension needs to be listed there.

Upvotes: 4

Related Questions