Image

Imagematthias382 wrote in Imagejava_dev 😯confused

NetBeans Issue

I'm having an issue with the NetBeans IDE. I'm trying to execute a program containing a line such as this...

JLabel usPic = new JLabel(new ImageIcon("icon.jpg"));

... which calls a file local to (i.e. in the same directory as) the program class files. In the case of images, the image simply doesn't get displayed. In the case of text files, I get an IOException saying that the file can't be found, such as this...

IOExcepetion: java.io.FileNotFoundException: ts.txt (The system cannot find the file specified)

The code will compile and run fine if I execute it via command line, however. Any idea if this is a bug in NetBeans or if there's a setting somewhere I need to change?