Joey7 Posted November 17, 2013 Share Posted November 17, 2013 Im trying to upload an image to this "game." i keep getting this error: sun.awt.image.ImageFormatException: Unsupported color conversion request at sun.awt.image.JPEGImageDecoder.readImage(Native Method) at sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:141) at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:269) at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:205) at sun.awt.image.ImageFetcher.run(ImageFetcher.java:169) here is the code: http://pastebin.com/8RpzkEi6 Quote Link to comment Share on other sites More sharing options...
Papa John Posted November 18, 2013 Share Posted November 18, 2013 Your not uploading anything with the sample code you gave, at best you would be linking an image. I think you need to give us a broader scope of the code because the fragment you gave doesn't seem to show anything related to the error. Quote Link to comment Share on other sites More sharing options...
Joey7 Posted November 18, 2013 Author Share Posted November 18, 2013 (edited) Your not uploading anything with the sample code you gave, at best you would be linking an image. I think you need to give us a broader scope of the code because the fragment you gave doesn't seem to show anything related to the error. well as i can see from reading the error it cant find the image. this should be the code that directs it to upload: ImageIcon i = new ImageIcon("C:/Documents and Settings/studio/My Documents/NetBeansProjects/JavaApplication9/src/javaapplication9/reddevilhead.gif"); face = i.getImage(); I dont know if i have the wrong url or im missing something... Edited November 18, 2013 by Joey7 Quote Link to comment Share on other sites More sharing options...
Papa John Posted November 18, 2013 Share Posted November 18, 2013 well as i can see from reading the error it cant find the image. this should be the code that directs it to upload: ImageIcon i = new ImageIcon("C:/Documents and Settings/studio/My Documents/NetBeansProjects/JavaApplication9/src/javaapplication9/reddevilhead.gif"); face = i.getImage(); I dont know if i have the wrong url or im missing something... The error has actually nothing to do with it being unable to find the image, instead it is an issue with the image decoder. In other words, it has found your image but it isn't following the correct format for the decoder. Does it give you the specific line that errors out? Quote Link to comment Share on other sites More sharing options...
Short Posted November 18, 2013 Share Posted November 18, 2013 The error has actually nothing to do with it being unable to find the image, instead it is an issue with the image decoder. In other words, it has found your image but it isn't following the correct format for the decoder. Does it give you the specific line that errors out? http://stackoverflow.com/questions/17797135/image-over-image-java Looks like an edited version of this. Quote Link to comment Share on other sites More sharing options...
Joey7 Posted November 18, 2013 Author Share Posted November 18, 2013 http://www.diffchecker.com/tvz6vers k Joeys on right - http://pastebin.com/8RpzkEi6 http://stackoverflow...ava-ball-moving - on left same language, means it will come out the same The error has actually nothing to do with it being unable to find the image, instead it is an issue with the image decoder. In other words, it has found your image but it isn't following the correct format for the decoder. Does it give you the specific line that errors out? Well this is all the info i have. No no error specific lines came out. Quote Link to comment Share on other sites More sharing options...
Papa John Posted November 18, 2013 Share Posted November 18, 2013 same language, means it will come out the same Well this is all the info i have. No no error specific lines came out. Well considering you just started learning the language the other day I would suggest you the nuances of the language first before you attempt to make a game. As you are currently trying to just throw code together that you got off the internet and that is the reason why it isn't working. If all you are doing is copying and pasting without actually taking the time to learn what the methods do and the best practices to use them you will have a hard time learning to code Java or any language for that matter. 3 Quote Link to comment Share on other sites More sharing options...
iPhobia Posted November 18, 2013 Share Posted November 18, 2013 Compilation error stdin copy Standard input is empty compilation info Main.java:12: error: class JavaApplication9 is public, should be declared in a file named JavaApplication9.java public class JavaApplication9 extends JFrame { ^ 1 error heres what i get when i run it dont know if that really matters much since i don't have the image anyways, but still Quote Link to comment Share on other sites More sharing options...
Joey7 Posted November 18, 2013 Author Share Posted November 18, 2013 Well considering you just started learning the language the other day I would suggest you the nuances of the language first before you attempt to make a game. As you are currently trying to just throw code together that you got off the internet and that is the reason why it isn't working. If all you are doing is copying and pasting without actually taking the time to learn what the methods do and the best practices to use them you will have a hard time learning to code Java or any language for that matter. i have been learning the language off youtube. I understand the things like methods, integers, all those basics. I also have some knowledge in python and its language, when i was looking at these tutorials on youtube i noticed how it really wasnt that different. I am not copying and pasting anything. I have books and stuff but i just find it easier off videos. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.