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.

Page 1 of 2 12 LastLast
Results 1 to 25 of 49

Thread: problem in sound files in created jar file

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default problem in sound files in created jar file

    hello friends,
    i am facing a problem...i have been running a java application with sound files...it is running fine in my system and when the jar file is created and run in some other machine everything is running fine except the sound files...we cannot hear sound when clicked on the application...i have tried the path problem...i have changed paths in 5 different ways but of no use.......i have installed net beans in that machine and found the application is running fine in that machine but only the sound file in jar file is not running...
    plzzzz help as soon as possible....


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Are you use any native API for sound? If yes, check the OS specs of your and your friend's machine. Also, are you sure, you move all the libraries, dlls (if required) within the jar file?

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    when i am running the jar file from the cmd prompt in the other machine its giving like this java.lang.noclassDefFoundError: com/sun/jna/NativeLibrary......why its giving so??????

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Because you are using a native library in your application and a proper native library is not imported/included in the jar to run over this machine.

  5. The Following User Says Thank You to Mr.777 For This Useful Post:

    uttam24april (December 12th, 2011)

  6. #5
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    how to include these libraries??? can u help me?????? plzz provide the steps..and thanks for the pain taken by u to read my problems and help me with solution...

  7. #6
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    NativeLibrary.addSearchPath("libvlc",System.getPro perty("user.dir") + "/La/La/VLC");...this is the main line where"java.lang.noclassDefFoundError: com/sun/jna/NativeLibrary" the jar file error is pointing to.....tell me how can i rectify this...plzz tell me in steps..thanks in advance

  8. #7
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Okay can you tell me which API's are you using in your application?
    Well, i can explain you with example.
    Let's say you've imported a library say ABC which is downloaded from www.xyz.com and there must be different versions for different OS. May be there is a cross platform library which will run in all platforms. But assume that you've downloaded the windows version and programmed your application on your machine, you run it and it runs and functions successfully. Now, as soon as you try to run jar file of your application on linux or say some other OS, you will get the error as you've used windows version library and some of the functions are not known by the current OS. So, there are two options now.
    1. Import the specific OS related version of library and try running jar.
    2. Import the cross platform version of library and you don't need to import for different versions.
    Note: Remember, there might be the possibility that some of the functions will be missing in cross platform library.
    Good Luck.

  9. The Following User Says Thank You to Mr.777 For This Useful Post:

    uttam24april (December 12th, 2011)

  10. #8
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    the system where the jar file is being run is using java version like this

    java(TM) 6 Update 24
    java(TM) SE Development Kit 6 Update 21

    while i m using the following java version...
    java (TM) 6 Update 30
    java (TM) SE Development kit 6 Update 3

    is this different version creating problems???????
    plzz reply and thanks for replying previously

  11. #9
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Quote Originally Posted by uttam24april View Post
    the system where the jar file is being run is using java version like this

    java(TM) 6 Update 24
    java(TM) SE Development Kit 6 Update 21

    while i m using the following java version...
    java (TM) 6 Update 30
    java (TM) SE Development kit 6 Update 3

    is this different version creating problems???????
    plzz reply and thanks for replying previously
    I am not sure if this difference of versions are creating problems coz it really depends upon the library you are using in your application. Can you tell me the libraries (API's) you are using?

  12. #10
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    classes12.jar, collections-generic-4.01.jar,colt-1.2.0.jar,commons-io-1.4.jar,,wstx-asl-3.2.6.jar...vlcj-1.2.0.jar...vecmath-1.3.1.jar....stax-api-1.0.1.jar....sqljdbc.jar....platform.jar....nblibr aries.properties......l2fprod-common-tasks.jar........jung-visualization-2.0.1.jar....jung-samples-2.0.1.jar.....jung-jai-samples-2.0.1.jar....concurrent-1.3.4.jar.....CustomeComponent.jar.....jna.jar etc are the libraries i have been using

  13. #11
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    vlcj.jar and jna.jar
    Check these two jar files from the official page, if they are platform independent or not. I am quite sure, there will be different versions for different OS and one cross platform version.

  14. The Following User Says Thank You to Mr.777 For This Useful Post:

    uttam24april (December 13th, 2011)

  15. #12
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    java.lang.noclassDefFoundError: com/sun/jna/NativeLibrary
    It's unable to find jna.jar file. Well, if you have included this, make sure, this jna.jar matches the OS specification as jna.jar is pure java code that is used to access native libraries.
    This might help you a little. JNA, using native code with Java, demo

  16. #13
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    i m using windows 7 basic and the machine where the jar file is being run is windows 7 ultimate....can it be so that the jna and vlcj jar files r not running in that machine with ultimate version...as far as i know ava is a Platform independent Language, moreover Jar contains only class files, and Java itself says that "Write Once Run Any where " so is it really the version problem??? or i m not been able to add the sound files to the jar...remember ever thing else in this application is running fine except the sound files.....plzz reply and thanks for ur effort..u can add me on uttam24april@gmail.com...we can have chat...

  17. #14
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Quote Originally Posted by uttam24april View Post
    i m using windows 7 basic and the machine where the jar file is being run is windows 7 ultimate....can it be so that the jna and vlcj jar files r not running in that machine with ultimate version...as far as i know ava is a Platform independent Language, moreover Jar contains only class files, and Java itself says that "Write Once Run Any where " so is it really the version problem??? or i m not been able to add the sound files to the jar...remember ever thing else in this application is running fine except the sound files.....plzz reply and thanks for ur effort..u can add me on uttam24april@gmail.com...we can have chat...
    Yes, you are right that Java is platform independent but the libraries that use native calls to OS are dependent. So, i guess yes there is difference between windows7 and windows7ultimate architecture(May be i am wrong). And one possibility might be that you are not adding sound (.dll) files to the jar. Well, an year before i used to develop a media player but i was successful in launching that to cross platform by using VLCJ and JNA. I guess you are missing dll's in your machine now. Add all dll's to the path. ALso, i can post you my jar file if you need that urgent. But i will recommend you to solve this problem on your own by getting little help from us.

    Most obvious point is: You are not putting sound files in the jar. Well dll's are not put in the jar but outside the jar (in your working directory).
    I hope after trying this, you will be able to solve this.
    For more help you can ask me here.
    Thanks.

  18. The Following User Says Thank You to Mr.777 For This Useful Post:

    uttam24april (December 13th, 2011)

  19. #15
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    i am using libvlc.dll, libvlccore.dll in the jar file......what else i have to add???????

  20. #16
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Quote Originally Posted by uttam24april View Post
    i am using libvlc.dll, libvlccore.dll in the jar file......what else i have to add???????
    Copy them out of the jar in your current working directory and see.
    Also, i guess there are not only two dll's but almost 6 to 8 dll's. Check on your machine where you've managed to run it. What were the dll's in your directory.
    I guess this is dll's issue in this machine. See all dll's for the jars and include them in working directory. can't remember the name of all dll's, it was an year ago actually.

  21. #17
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    in my machine i m running it on net beans the jar file that is created is being run on other machine.....all the .dll files have been given in the folder named VLC and it is also provided in the machine that is used to run the jar files..still not running...its becoming more n more confusing for me

  22. #18
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Yeah that's what am i asking you to do.
    Example:
    You have your project in say D:\NetBeans Projects\Your_Application
    Now, copy the whole Your_Application from your machine to other machine and then go to Your_Application\dist and run the jar file. Then tell me if this solves the problem or not.
    If it solves the problem, it means you have dll's files in your current project directory.
    If it doesn't, it means you either have installed some program of which your application is using dll's.

    Well, first try copying the whole folder to other machine and run jar, then tell me.
    I am waiting for your reply.

  23. #19
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    i had already done that...i have copied the total application in the other machine.....i even have installed net beans in that machine....i have run the files there and the same problem persist even there.....only when it is run on net beans the sound files are heard but when the jar file is prepared there is problem again.....plzz help me what i have to do

  24. #20
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    @utam24april: I guess you must be able to know now that issue is not with the application then but with the deployment of files on the other machine.
    Listen, just take a break, get relaxed and now don't run application with Netbeans but just copy the whole folder to the new machine and run jar only from dist folder. Don't delete anything from the folder, and i am sure you will be able to run this.
    Just apply this test case:
    Copy the whole folder from the machine where you are able to run this application, on the current machine. Go to dist folder and run jar. Now tell me what happens? Don't try any other operation.

  25. #21
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    i did that same problem persist.....sound cant be heard.......plzz tell me what to do..

  26. #22
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    i did that same problem persist.....sound cant be heard.......plzz tell me what to do..

  27. #23
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Download this on your current machine and run, if sound appeared here, it means you are missing something while deploying here. Might be there are some plugins folder that you are not moving to the machine.
    Download vlcj.jar : vlcjvJar File Download

  28. #24
    Junior Member
    Join Date
    Dec 2011
    Posts
    28
    My Mood
    Fine
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default Re: problem in sound files in created jar file

    no friend i have added everything...i have moved the total lib file containing all the jar files....this vlcj.jar is there in lib and i have moved that too.....somehow its not running......

  29. #25
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: problem in sound files in created jar file

    Quote Originally Posted by uttam24april View Post
    no friend i have added everything...i have moved the total lib file containing all the jar files....this vlcj.jar is there in lib and i have moved that too.....somehow its not running......
    Well, what else can i say further? I got no more solution for this. Hmmm..... may be Windows Ultimatum doesn't support this. (My opinion, can be wrong though)

  30. The Following User Says Thank You to Mr.777 For This Useful Post:

    uttam24april (December 14th, 2011)

Page 1 of 2 12 LastLast

Similar Threads

  1. [SOLVED] no sound from executable jar file
    By cl2606 in forum What's Wrong With My Code?
    Replies: 17
    Last Post: June 8th, 2011, 06:41 PM
  2. Not able to put some files inside Zip file
    By chinnu in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: March 23rd, 2011, 05:17 AM
  3. making a .bat file that compiles your java files
    By sp11k3t3ht3rd in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 24th, 2010, 12:55 AM
  4. outputing to a text file from sound API
    By bondage in forum File I/O & Other I/O Streams
    Replies: 10
    Last Post: May 2nd, 2010, 11:43 AM
  5. [SOLVED] Program to read from created file
    By aznprdgy in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: April 7th, 2009, 03:51 AM