0

I made a jar file, and I have a problem with images when I run it in the web. (I'm using Amazon EC2)

Currently I think I'm lost at setting the path. It works well on my local host when I set the path to something like img src= "/img/1.jpg".

So, with URL URL = getClass().getClassLoader().getResource("img/1.jpg"); I get a path that starts with jar:file~~ when I run it.

But on the web, it doesn't display the image. I just see a small square icon where the image is supposed to be.

Would this be a path related issue? Or something else? How should I set the path to resolve the problem?

I'm a beginner and I'd appreciate any help. :)

roras
  • 1
  • 1

1 Answers1

0

see this.

Example

ClassPathResource resource = new ClassPathResource("application.yml");
InputStream inputStream = resource.getInputStream();
Zhefang Wu
  • 19
  • 6