Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Image Uploading Error


Joey7
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 by Joey7
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

  • Like 3
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share