Intellij can not resolve path for image in resources folder on local and absolute paths
Answered
Using this link as a reference:
https://www.jetbrains.com/help/idea/add-items-to-project.html#import-image-to-project
when I mark a folder as resources in my project then add an image to that folder the project can not access it. It can use an absolute path or a local path but when the project gets pushed these paths dont exist
Path current = Paths.get("../resources/small_eye.png");
String s = current.toAbsolutePath().toString();
System.out.println(s);
Icon icon3 = new ImageIcon("C:\\Users\\mpatwil\\Documents\\TLG\\Java\\Project\\maybe images\\bald_eagle.png");
ImageIcon icon4 = new ImageIcon("C:\\Amazon SDE\\Java1\\Java-Part1\\StudentWork\\IntmJ\\untitled\\BoardTest\\resources\\small_eye.png");
ImageIcon icon = new ImageIcon("resources/small_eye.png");
ImageIcon icon2 = new ImageIcon("resources/bald_eagle.png");
JLabel button7 = new JLabel(icon);
Please sign in to leave a comment.
Does the IDE find files if you load resources with ClassLoader? E.g.:
See also https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html .