Eclipse IDE project directory structure help [Java]
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:
http://img26开发者_如何学编程2.imageshack.us/img262/8415/directory.png
Thanks!!
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:
"src/Textures/Crate.png"
But better would be to get the image as a resource, not as a file using the Class#getResourceAsStream.
Drag using the mouse your Textures folder to the LWJGL 6 project folder.
Try giving src/Textures/Crate.png
as the path to the FileInputStream
constructor.
精彩评论