#Resources not being included in project build.

11 messages Β· Page 1 of 1 (latest)

raven siren
#

Hi there πŸ‘‹

I'm using the VS Code extension for Java Development (by Red Hat or something?) and am trying to build myself a very basic game engine for a 2D platformer. It's just a side project as I haven't used Java since the early Minecraft modding days.

Anyways, I'm trying to use a InputStream to get a BufferedImage (java.awt, I believe) to but it cannot seem to find my image resource. Code snippets below!

If someone can give me a hand, I would very much be appreciative! Cheers! :)

astral patrolBOT
#

βŒ› This post has been reserved for your question.

Hey @raven siren! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

raven siren
#

That's the path I'm using...

#

The method I'm using to load the image.

#

If it helps, my bin folder does not contain a resources folder. I've tried adding it to the VS Code classpath, I don't know if that's 100% correct, but it's the steps ChatGPT suggested (yes, I know)

#

This exact code worked perfectly in Eclipse, but having switched to a new project in VS Code, using the Java: New Java Project palette command, it just refuses to work.

bleak shard
#

getResourceAsStream will get its data from src/main/resources afaik

cyan merlin
#

So fundamentally, for the above to work, the classpath needs to include something that has a sprites folder, that has a debug folder, that contains a square.png file. How to do that in VSC, I wouldn't know.

digital umbra
#

are you using maven/gradle?