Hi everyone, i must learn JME quickly for a student project so i'm actually following the excellent tutorial "Learning JME".
But I got a problem when i want to load a texture :
myTexture = TestState.class.getClassLoader().getResource("jmetest/data/images/Monkey.jpg");
It works with this code but if i change the location, i can't load it anymore.
For example, if i copy Monkey.jpg in jmetest, and use "jmetest/Monkey.jpg", it doesn't work!
I think that the code above search the texture in another repertory than the one i use.
Can someone can explain how this instruction works and how i can load a texture in "C:/MyTextures" (for example) ?
How did you copy and what IDE are you using? If you e.g. copied with the explorer eclipse won't recognize that unitl you refreshed your project (right-click on project->refresh). Actually that is my first thought when I read your problem!
Hope that helped…
actually… since you are working on a project… you should include all files such as textures and just about everything within the src folder of you project… you could make subfolders there if you want… but make sure the files are within your project folders so that eclipse will easily find those files when you use the code
and don't forget to refresh the project so that newly copied files onto the directories are included, like ttrocha said…
Hope this helps
Refresh the project was the solution!
Thank you guys, i spent few hours reading stuff about URL class whereas the solution was really simple!
I can now continue my learning and begin my project soon (an online poker game).
Thank you again!