InputStream/Jar Problems/File IO Problems
Alright, so i give up, i've tried almost everything i know i can do here. I created a game engine, the game engine is all packaged into a Jar file, resources, everything. When i run the program my exception logger catches the following error below. For some reason nothing loads into the program. I'm attempting to load images, audio, and text. The program runs and my exception logger logs all the exceptions and says the program is safe to run. Though i dont have audio or graphics going.
Exception:
FileNotFoundException
now i know what that means, but i dont understand why it cant find the file. I made sure that paths are ALL correct, here is some code as to how i am approaching this.
To load an Image i do:
String fileName = "testgame/resources/images/image.bmp";
Quote:
InputStream is = new BufferedInputStream(new FileInputStream(fileName));
image = ImageIO.read(is);
To load audio i do:
Quote:
AudioInputStream stream;
File fileName = "testgame/resources/audio/audio.wav";
songTrack = new File(fileName);
for (int i = 0; i < clipSize; i++) {
stream = AudioSystem.getAudioInputStream(songTrack);
clip[i] = AudioSystem.getClip();
clip[i].open(stream);
}
return true;
To load text i do:
Quote:
File file = new File("testgame/resources/level/level.lvl");
Scanner fileScanner = new Scanner(file);
So i dont know whats going on, the only exception thrown is the
file not found exception for EVERY file, image, audio, and text.
The Main class file is in a folder in the JAR called Clash20 and the
folder testgame is in a folder within the jar called clash20 where the Main class file is.
So i really dont know whats going on. Please help. If you have any more
info you need please ask.:confused: