i have a card game project that works fine untill i use eclipse to open it up.
if i try to export it to a jar file or launch it from cmd, i keep having java.io.FileNotFoundException whenever i try to acces to folders or files.
For example i have a AudioManagert class that plays the resource giving his path as string.
this is working if i launch the program from eclipse, it doesn't from cmd.
Another example is when i try to load an image to create a new ImageIcon
new ImageIcon(getClass().getResource("/src/controller/resource/account.jpg"));
this would work on eclipse, not from cmd
how can i fix this problem? is there something to do with the use uf the path as a string?
here my AudioManager class method play()
public void play(String filename) {
try {
InputStream in = new BufferedInputStream(new FileInputStream(filename));
AudioInputStream audioIn = AudioSystem.getAudioInputStream(in);
clip = AudioSystem.getClip();
clip.open(audioIn);
clip.start();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
} catch (UnsupportedAudioFileException e1) {
e1.printStackTrace();
} catch (LineUnavailableException e1) {
e1.printStackTrace();
}
}
here my call from the program too it
AudioManager.getInstance().play("./src/resource/sposta.wav");
this works on eclipse, not on cmd
i add the image of where my audio and image resource are stored inside my project....