Take the 2-minute tour ×

I have been learning Java and have had no problem with projects in which multiple .java files were in the same Default Package. I am now trying to separate code and create folders for images, but everything I have tried has failed.

How do I properly add folders for images and other classes, and properly set the path to it? All paths should be relative to the project, I know that much ;_;

Here's a link to a picture of my IDE and error message from program output:



share|improve this question
add comment

3 Answers

up vote 6 down vote accepted

First off, your Java code itself should go into a package, not the default package. Next, you may be able to refer to the image file by prepending src/ to your path:


But better would be to get the image as a resource, not as a file using the Class#getResourceAsStream.

share|improve this answer
Ok thanks, I get how the directory structure works. What should I call my package though? And what do I do with the default, right-click delete? –  shadowprotocol Nov 30 '10 at 2:54
src is not a package, not at all. You create a package inside of src by right clicking on it and then clicking on New, then Package. Then you can drag your source files into this package. –  Hovercraft Full Of Eels Nov 30 '10 at 2:57
I understand, thanks dude! –  shadowprotocol Nov 30 '10 at 2:57
Wonderful, glad it helped! :) –  Hovercraft Full Of Eels Nov 30 '10 at 2:59
add comment

Drag using the mouse your Textures folder to the LWJGL 6 project folder.

share|improve this answer
add comment

Try giving src/Textures/Crate.png as the path to the FileInputStream constructor.

share|improve this answer
add comment

Your Answer


