954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem with Java -> .jar file -> exe file

hey i am making a game and i wanted to see it as an exe file so i took the java code, creater a jar file, and then created a exe file. When the program runs on my computer it works fine, all the images load since they are on my computer, but when my friend runs it on his computer the images arent there. Is there any way to have the images stored in the exe file or something like that so if i gave the exe to anyone the images would always load?

corby
Junior Poster
118 posts since Feb 2010
Reputation Points: 6
Solved Threads: 5
 

You need to put all the images in the jar file.
When you do that, you will need to change the way the image files are read from using disk files to using resources.
There is lots of code samples on the forum that does this. Search for getResource and getResourceAsStream for examples.

I have no idea if the converted (to .exe) jar file would execute the same as the jar file with the java command.

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: