Hi, I finished my game, and I would like to "publish" it, however when I Export the project alongside the resource files, the jar file does not:
1-Play the music
2- Display Pictures
3- Start the actual game.
Untitled.png
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hi, I finished my game, and I would like to "publish" it, however when I Export the project alongside the resource files, the jar file does not:
1-Play the music
2- Display Pictures
3- Start the actual game.
Untitled.png
You need to debug the code to see what the problems are.
Open a command prompt window and enter the java command to start the execution:
java -jar TheJarFileNameHere.jar
That will allow you to see any error messages written to the console.
Copy the full text of any error messages you want help with and paste it here.
If there aren't any error messages, then some println() statements need to be added to the code so show what the code is doing and what the values of variables are.
If you don't understand my answer, don't ignore it, ask a question.
The command prompt tells me it can not execute.
Please copy the full contents of the command prompt window and paste it here.
On Windows: To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
If you don't understand my answer, don't ignore it, ask a question.
I placed the jar file on my desk topMicrosoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\sakonpure6>java -jar HalfLife3.jar
Error: Unable to access jarfile HalfLife3.jar
C:\Users\sakonpure6>
The jar file must be in the same folder where the java command is executed. For the last post that would be:Unable to access jarfile HalfLife3.jar
C:\Users\sakonpure6
If you don't understand my answer, don't ignore it, ask a question.
Thanks, this is what I got.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\sakonpure6>java -jar HalfLife3.jar
java.io.FileNotFoundException: Music\intro.wav (The system cannot find the file
specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at com.sun.media.sound.WaveFloatFileReader.getAudioIn putStream(Unknown S
ource)
at javax.sound.sampled.AudioSystem.getAudioInputStrea m(Unknown Source)
at Game.PlaySound$1.run(PlaySound.java:29)
at java.lang.Thread.run(Unknown Source)
java.io.FileNotFoundException: Music\RisenShine.wav (The system cannot find the
file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at com.sun.media.sound.WaveFloatFileReader.getAudioIn putStream(Unknown S
ource)
at javax.sound.sampled.AudioSystem.getAudioInputStrea m(Unknown Source)
at Game.PlaySound$1.run(PlaySound.java:29)
at java.lang.Thread.run(Unknown Source)
java.io.FileNotFoundException: Music\music.wav (The system cannot find the file
specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at com.sun.media.sound.WaveFloatFileReader.getAudioIn putStream(Unknown S
ource)
at javax.sound.sampled.AudioSystem.getAudioInputStrea m(Unknown Source)
at Game.PlaySound$1.run(PlaySound.java:29)
at java.lang.Thread.run(Unknown Source)
Error Loading Map.txt File.
Exception in thread "Thread-6" java.lang.NullPointerException
at Game.Map.readFile(Map.java:170)
at Game.Map.<init>(Map.java:27)
at Game.Board.<init>(Board.java:73)
at Game.Main$3.run(Main.java:70)
at java.lang.Thread.run(Unknown Source)
C:\Users\sakonpure6>
Is that file in the jar file? If so the code must treat it as a resource and use one of getResource methods to access it.java.io.FileNotFoundException: Music\intro.wav (The system cannot find the file
specified)
If it can't be in the jar file, then the Music folder must be in the same directory as the jar file.
If you don't understand my answer, don't ignore it, ask a question.
k thank you