I created a small little java game and sent it to my friends but I realized that they don't have the images so they won't see the pictures that I put in the game. How would I make it able for them to view these images. Do I put them in the jar somehow? And what would I put for the path to these images?
Yes, put them in the Jar, often in their own directory, possibly off of the directory that holds the class files. You'll want to access them using resources not as files. The tutorials should show you the way.
I spoke too soon, I thought I had it but this code
I don't know why it doesn't work, the System.out.print prints out this
Which appears correct but it won't run. Compiles fine but won't run.
Can I only run this when it is in the jar?
What happens when you try to run it? Any exceptions get triggered?
For my money, I'd try to create a small program that does nothing more than create an ImageIcon, places it in a JLabel, and shows the JLabel in a JOptionPane, and then make a Jar of it. If you can get this to work, you can get your main program to work, I'll bet.
Here is my entire code for the main class. If you need all the other classes I can post them. The error I get is a null pointer exception for this code
EDIT: I set the private ImageIcon icon = new ImageIcon();
and I don't get the null pointer exceptions but now none of the images appear
It still prints out the correct file path and everything but no image appears
Is the Run1.jpg file located in the same folder (inside the JAR or not) as your Dodge.class file?
Oh, and change line 35 to "icon = ...". You are now declaring a new local variable that is instantiated in the if-block (if the resource is found). After that it goes out of scope (as I said) and the non-instantiated (and therefore null) icon instance field is used.