how to add an image into netbeans Java project
Solution 1
If you run the program from netbeans, the root folder should be the same as the root of the project folder. That is, the folder which contains build.xml and manifest.mf.
If putting your image directly in that folder, and loading it without any path given doesn't work, then you will have too look at your code and see if you can find any errors.
Solution 2
Try looking at you project directory and find where the html/xhtml files are. Mostly it will be located inside the web directory within the project directory projectname/build/web. That will be source for the image tag in your html page you can directly give the name of the image for "src".
Khoi
Updated on June 11, 2022Comments
-
Khoi about 2 years
I'm doing a simple Java project on Netbeans. And I'm stuck not knowing how to add my own image into the code. It kept throwing IOException no matter where I put the image. This sounds ridiculous but it really got me stuck.