• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Uanble to run Sound file after building Jar file. i am using Jlayer

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello every one
i am having bit problem in my first java game project. my program works very well in netbeans before building jar file. My sound files dont work in .Jar

i created some common classes(BackGroundMusic.java and Music.java) for 2 games Soundtoguess and ImagetoGuess
then as both game need to acess files from different folder so i created classes for both games (named SoundtoGuess.java and PhototoGuess.java)
then i created objects of both these in my actuall game and run them accorindingly..

like
SoundtoGuess NowAnimal = new SoundtoGuess("Lion");
NowAnimal.SoundFile.start();

but it is not working in jar file.


My directory is like this

Parent Folder

PsychOut
-->Build

-->dist

-->nbproject

-->SoundLibrary
---------------->jlayer.jar


-->src
------->Data

------->CommonClasses
-------------------------->BackGroundMusic.java
-------------------------->Music.java
-------------------------->ReadTextFile.java

------->Images
------------------------->IdentifySound//folder for images of IdentifySound game
------------------------->IdentifyImages//folder for images of IdentifyImages game

------->Sounds
------------------------->IdentifySound////folder for Sounds of IdentifySound game
------------------------->IdentifyImages//folder for Sounds of IdentifyImages game

------->IdentifySound
------------------------->SoundtoGuess.java
------------------------->Jungle.java

------->IdentifyImages
------------------------->PhototoGuess.java
------------------------->IdentifyPhoto.java

------->test


coding of files are as below

First Common Classes

Music.java



BackGroundMusic.java



PhototoGuess


SoundtoGuess






and in file i am creating many different object of Soundtoguess and ru it like
SoundtoGuess NowAnimal = new SoundtoGuess ("Lion");
NowAnimal.SoundFile.start();


it works fine in neytbeans with no error.. but not in jar file.. please give me detailed answer thank you verymuch
Untitled.png
[Thumbnail for Untitled.png]
jar file opened with winZIP
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should definitely check out how Class.getResource works.
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic