New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't load image through the given file path #45
Comments
Can you post the code to a branch and give the link here? |
Hi Prof, This is the link my duke.java https://github.com/lawncegoh/duke/blob/master/src/main/java/Duke.java |
Just one file is not enough. Someone should be able to reproduce the problem by cloning your repo. Are all the relevant files in the master branch? If not, push the current state of the repo to a separate branch and give the link to the branch. |
Please read this to find out how to access file in your resources folder https://www.mkyong.com/java/java-read-a-file-from-resources-folder/ |
@j-lum can help? |
Have these 2 lines in my duke main class.
private Image user = new Image(this.getClass().getResourceAsStream("/images/DaUser.png "));
private Image duke = new Image(this.getClass().getResourceAsStream("/images/DaDuke.png "));
These are the file paths:
/Users/lawnce/Desktop/duke/src/main/resources/images/DaUser.png
/Users/lawnce/Desktop/duke/src/main/resources/images/DaDuke.png
This is the error i encounter. I tried solving through the Slack channel's way of renaming the file directly to resources or adding / in front of images but it doesn't work somehow
The text was updated successfully, but these errors were encountered: