Question:
How to get eclipse to recognize .png files (java)?
?
2013-12-23 10:38:05 UTC
So I have been programming in java for several years. and this is the first time I have ever seen this problem. So far no one has been able to answer, so thank you for anyone who suggests an answer. In java, I use the eclipse IDE to program games and other applications. I recently just got a new computer , and installed java and everything on my computer and began to program an application I have been working on for a few days, I go to re load .png images into eclipse. (normally I just drag and drop the the image into a folder) but for some reason the the thumbnail image for a .png image wasn't correct. For some reason, the thumbnail for the images I imported looked like a txt file. i tried calling the images through there file path, and it says that it can't load the image. I literally have the same code from my old computer placed on my new computer. I did some tests and I find that it can't recognize that .png images. I figured since it has a new operating system, it might just be the new icon (windows 8). But .png images still have the classic flower thumbnail. After several more tests, I have concluded that its eclipse not recognizing the images. I have done everything to test this. I have tried changing my version of eclipse, overwriting the image, creating a new folder, changing work spaces, re-installing java, checking the imported images are actually of type .png, and googled around for a couple hours. I have done everything and concluded it must be a setting in eclipse that I have missed. If anyone could please help, that would be greatly appreciated! thanks again
Five answers:
?
2013-12-23 10:59:06 UTC
General -> Editors -> File Associations



There you can edit what File Types Eclipse responds to. By default, it does not associate PNG files to any editor. You can use the bottom portion to choose to the default association for .png to be PNG File. It will then change anything in the editor with *.png to an image of whatever PNG File is. (For windows it is a picture of a flower)
?
2016-12-12 21:45:33 UTC
Eclipse Png
deonejuan
2013-12-23 12:55:38 UTC
An IDE will database paths as a project is created. Moving the project to a new workstation can give incorrect targets. Furthermore, the IDE will create folders for source file folders and .class file folders. The JRE will point to the CWD. The IDE will point to the top-level of the project (above the source and class folders).



Java natively recognizes two graphic file formats: jpg and png. If your icons are screwed up on the desktop, you have an OS problem.



The link below should work if your graphic is inside a folder /images and that folder is inside the folder wherever the class files are.
anonymous
2013-12-23 10:41:40 UTC
Firstly, eclipse is awful in this regard. I've also noticed some of these problems. Why does it matter what the icon image is in your workspace directory? Did you try right clicking on the file and seeing the specific options such as what application to open the file with?



Importantly, note that it doesn't matter if eclipse doesn't have a pretty image icon for your picture. When you run your java code, it doesn't use that image icon or anything like that, so it won't affect your code at all. I understand it's annoying to look at an image file that has a weird icon associated with it.
anonymous
2016-03-13 16:13:35 UTC
What are you go to do with the class file, Are you going to edit it, never knew you could edit a .class file did you mean .java file


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...