Jar file - trying to load audio from within it

I am writing a Game using NetBeans. All works fine when run from within NetBeans, but problems occur when run from a JAR executable.
The Audio files are not loading. I had a Similar problem with the Images, but resolved it with getResources() etc.
Any help would be much appreciated, and will post my game when its finished, horray
     * Loads a sequence from the file system. Returns null if
     * an error occurs.
    public Sequence getSequence(String filename)
        try
            return getSequence( new FileInputStream(filename));
        catch (IOException ex)
            ex.printStackTrace();
            return null;
     * Loads a sequence from an input stream. Returns null if
     * an error occurs.
    public Sequence getSequence(InputStream is)
        try
            if (!is.markSupported())
                is = new BufferedInputStream(is);
            Sequence s = MidiSystem.getSequence(is);
            is.close();
            return s;
        catch (InvalidMidiDataException ex)
            ex.printStackTrace();
            return null;
        catch (IOException ex)
            ex.printStackTrace();
            return null;
    }

new FileInputStream(filename))That only works for files. Resources in JARs are not files. You should always (when possible) use getClass().getResourceAsStream() to open streams on resources, loading them from the classpath -- regardless of whether your app is a bunch of loose files or in a JAR.

Similar Messages

  • I'm using iweb 3.4 and trying to load audio files to my web page.  everything looks good in iweb but after publishing instead of having a control bar i have a "?".  does anyone know what to do?

    I'm using iweb 3.4 and trying to load audio files to my web page.  Everything looks good in iweb but after publishing instead of having a control bar i have a "?".  Does anyone know what to do?

    Where are you hosting the site, how are you uploading the files and what's the URL of your site so we can examine it first hand?
    Adding audio files by dragging onto the web page forces the viewer to have Quicktime installed on their computer in order to be able to listen to them.  Look at the audio player options on this page of Roddy's iWeb for Musicians site: Audio Players for your Music Website. 
    OT

  • Required the details of jar files which is loaded in the database

    Hi
    We are having a 10g database which is running under Solaris machine. There are lot of .jar files which are loaded into the database. I would like to know how to find those .jar file details atlease the name of the files which are loaded in the database. Is there any view for this.
    I couldnt find anything from the Java option in TOAD
    Please provide a solution.
    Thanks
    SHIYAS M

    From 11g onwards, you have
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> desc javajar$
    Name Null? Type
    NAME NOT NULL VARCHAR2(30)
    OWNER# NOT NULL NUMBER
    PATH VARCHAR2(4000)
    CONTENTS BLOB
    SQL> desc javajarobjects$
    Name Null? Type
    JARNAME NOT NULL VARCHAR2(30)
    OWNER# NOT NULL NUMBER
    OBJNAME NOT NULL VARCHAR2(40)
    NAMESPACE NOT NULL NUMBER

  • Error when trying to load data from ODS to CUBE

    hi,
      Iam getting a short dump  when trying to load data from ODS to CUBE. The Run time error is 'TYPELOAD_NEW_VERSION' and the short text is 'A newer version of data type "/BIC/AZODS_CA00" was found than one required.please help me out.

    Hi,
    Check this thread.........Ajeet Singh  has given a good solution here.........
    Re: Error With Data Load-Getting Canceled Right Away
    Also check SAP note: 382480..................for ur reference............
    Symptom
    A DART extraction job terminates with runtime error TYPELOAD_NEW_VERSION and error message:
    Data type "TXW_INDEX" was found in a newer version than required.
    The termination occurs in the ABAP/4 program "SAPLTXW2 " in "TXW_SEGMENT_RECORD_EXPORT".
    Additional key words
    RTXWCF01, LTXW2U01, TXW_INDEX
    Cause and prerequisites
    This problem seems to happen when several DART extraction jobs are running in parallel, and both jobs access table TXW_INDEX.
    Solution
    If possible, avoid running DART extractions in parallel.
    If you do plan to run such jobs in parallel, please consider the following points:
    In the DART Extract configuration, increase the value of the parameter "Maximum memory allocation for index (MB)" if possible. You can estimate reasonable values with the "File size worksheet" utility.
    Run parallel DART jobs on different application servers.
    As an alternative, please apply note 400195.
    It may help u.........
    Regards,
    Debjani.......

  • IPhoto doesn´t work after trying to load photos from iphone with newer version. Help!!!!!

    First, I do not have a recent back-up of my iPhoto Library. (But, I learned my lesson for next time). When I tried to load photos from my super duper up to date software I-phone to my outdated iPhoto on the computer (only version 8.1.2), a message came that I cannot open your Mediateck with this version of iPhoto,. You have changed your mediathek with a newer version of iPhoto.
    (in German, because I am writing from Germany "Sie konnen ihre aktuelle Mediathek nicht mit dieser Version von iPhoto öffnen. Sie haben Ihre Mediathek mit einer neueren version von iPhoto geändert").
    How can I save all the baby pictures of my 3 kids??Help

    Did you update iPhoto?
    If not:
    Try these in order - from best option on down...
    1. Do you have an up-to-date back up? If so, try copy the library6.iphoto file from the back up to the iPhoto Library (Right Click -> Show Package Contents) allowing it to overwrite the damaged file.
    2. Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.
    3. If neither of these work then you'll need to create and populate a new library.
    To create and populate a new iPhoto 08 library:
    Note this will give you a working library with the same Events and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    In the iPhoto Preferences -> Events Uncheck the box at 'Imported Items from the Finder'
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library (Right Click -> Show Package Contents) on your desktop and find the Originals folder. From the Originals folder drag the individual Event Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption.

  • I am trying to load photos from my computer on to my ipad but keep getting the message "the device is no longer connected to the computer. It keeps popping up and I am stuck. This happened after I upgraded to the latest itunes

    I am trying to load photos from my computer on to my ipad but keep getting the message "the device is no longer connected to the computer". It keeps popping up and I am stuck. This happened after I upgraded to the latest itunes software.

    Greetings cdewinkel,
    It seems your iPad is not staying connected to your computer during syncing. The following article provides a number of troubleshooting steps which may help. This article is intended for devices which are not being detected, but the troubleshooting steps are relevant to your issue:
    If you don't see your connected device in iTunes for Mac - Apple Support
    Make sure that your device is on
    Also make sure that you can get to the Home screen.
    Get help if you have one of these issues:
    Your iOS device won't respond or turn on.
    Your iPod won't turn on.
    You forgot your passcode or your device is disabled.
    Make sure that your Mac supports your device
    See the system requirements for iPhone, iPad, or iPod.Check your USB connections
    Unplug other USB devices from your Mac and try again.
    Try a different USB port.
    Try a different USB cable. 
    Learn more about using USB cables with your Mac.Make sure that your device trusts the computer
    You might get an alert if you haven't connected your iOS device to this computer before. Unlock your device and tap Trust. 
    Learn more about the Trust This Computer alert.Restart your device
    Restart your iOS device or reset your iPod.Restart your Mac
    Turn your Mac off and back on.Update your software
    Check for software updates on your Mac.
    Check for an iTunes update.
    Check your security software
    If you have security software installed, learn how to resolve issues between iTunes and your security software. 
    Get more help
    If you still don't see your device in iTunes, contact Apple Support.
    Thank you for contributing to Apple Support Communities.
    Best,
    Bobby_D

  • I'm trying to load everything from my phone to computer so I can reset for phone and start clean and when I plug it in the computer nothing comes up and there is a connection what going on

    I'm trying to load everything from my phone to computer so I can reset for phone and start clean and when I plug it in the computer nothing comes up and there is a connection what going on

    Is your iPhone not showing up in iTunes sidebar, or is iTunes not just launching automatically?
    The things that you can check are:
    1) Launch iTunes manually
    2) Restart or reset your iPhone (http://support.apple.com/kb/ts3281)
    3) Check your cable including disconnecting and reconnecting it on bot the phone end and the computer USB end.
    4) Reboot your computer
    5) As a last resort, take it to the Apple Store so they can check the hardware

  • Trying to load efax from new hp emachine.  you get this; You can't open the application "eFax Messenger" because PowerPC applications are no longer supported.

    trying to load efax from new hp emachine.  you get this
    ;You can’t open the application “eFax Messenger” because PowerPC applications are no longer supported.
    when is hp, efax, or apple getting their act together to fix the issue?

    Hi,
    The eFax service provided with the HP device is a remote cloud feature and have nothing to do with installing any software on your computer.
    Any software named eFax you may trying to install is not affilated with HP in any way, as well I doubt if it is affilated with the eFax service in any manner.
    In order to enable and use the eFax feature please follow the steps below:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02970945&tmp_task=useCatego ry&cc=us&dlc=en&lang=en&lc=en&product=5070121
    Regards,
    Shlomi

  • Crystal Reports XI R2 Server problem when trying to load groups from LDAP

    Hi,
    I'm using Crystal Reports XI R2 SP4 on RedHat Linux. My users are being authorized through LDAP (OID). My problem is that after removing all groups (right now no groups/users are visible in CMC) in CMC Authentication tool and then trying to add them again I'm receiving following error:
    "LDAP: Failed to commit objects to server : Duplicate object name in the same folder."
    I've checked connectivity to LDAP server and it's ok. Could it be connected to CMS problems/corruption? Any help/suggestions would be appreciated.
    Regards,
    Marcin

    The only personal folders visible from under Admin panel are for users Administrator and Guest. I've tried to query CMS tables but these store entries not in plain text so I cannot identify entries connected to personal folders. I have also tried to do this via Query Repository tool but all returned entries were ok.
    I have also noticed that when trying to load group from LDAP after it returns error "LDAP: Failed to commit objects to server : Duplicate object name in the same folder." entry for this group is created in CMS table. Also this group is then visible in admin Groups panel. No users are created with the group and when I'm trying to list users belonging to added group it returns "internal secLDAP security plug-in error" but without any other suggestion what went wrong.

  • IPhone 6plus camera freezes when trying to take photos from within other apps

    Hi,  8.1 6Plus,   my regular camera turns black screen when trying to take photos from within other apps or sometimes between photos in the regular camera app.  I can still take a photo, I just have no idea what I'm seeing or taking a picture of.   Then when I press retake (in other apps) the screen comes back on and it works.   Its annoying more than anything else.   Any ideas? Have done the whole close apps/restart process.
    Thanks!

    What version of iPhoto? How much disk space did you have before deleting things?
    Regards
    TD

  • What should I do if I am trying to add audio from iTunes onto a Powerpoint presentation, but it keeps saying that I must first open up iTunes before I can access the music?

    What sould I do if I am trying to add audio from iTunes onto a powerpoint presentation, but when I click on the Audio >> Audio Browser icon a little side bar pos up which says you must first open iTunes before you can access the music here (different words) even though I already have iTunes open on my computer.

    Sandra Powers 14\' wrote:
    which says you must first open iTunes before you can access the music here (different words)
    Perhaps you would tell us what words it does show...

  • Jar file is not getting executed from commandline

    Hi ,
    this is the weired problem i had.
    i have created a executable jar file.When i double click that file it is getting executed without any problem but when i go to command prompt and tries to run this jar by using folowing command
    java -jar myjar.jar
    it is giving me the error as
    Exception in thread "main" java.lang.UnsupportedClassVersionError:com/build/deploy/Deploy (Unsupported major.minor version 49.0)
    i am not getting why it is giving me this version error.
    can any body answer my question.
    i am using version JDK1.5 also program is running perfesctly from ecllipse IDE.

    I believe that something in your system is set up so that when you double click the jar, the correct java or javaw version is being used, but when you use the command line, an older version of java is being used.

  • Add a jar file to Java load path at run time

    Hi
    I loaded my file successfully , but when I tried to use the driver to connect to the DB , I get
    java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
    Here is my class
    import java.net.URL;
    import java.io.IOException;
    import java.net.URLClassLoader;
    import java.net.MalformedURLException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.io.*;
    public class JarFileLoader1 extends URLClassLoader
    public JarFileLoader1 (URL[] urls)
    super (urls);
    public void addFile (String path) throws MalformedURLException
    String urlPath = "jar:file://" + path + "!/";
    addURL (new URL (urlPath));
    public static void main (String args[])
    try
    File f = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc.jar");
    System.out.println("%%%% " + f.exists());
    File f1 = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc_license_cu.jar");
    System.out.println("%%%% " + f1.exists());
    File f2 = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc4.jar");
    System.out.println("%%%% " + f2.exists());
    URL urls [] = {};
    JarFileLoader1 cl = new JarFileLoader1 (urls);
    cl.addFile ("E:\\db2_v9_5 FP5_drivers\\db2jcc.jar");
    cl.addFile ("E:\\db2_v9_5 FP5_drivers\\db2jcc_license_cu.jar");
    cl.addFile ("E:\\db2_v9_5 FP5_drivers\\db2jcc4.jar");
    URL url = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc.jar").toURL();
    URLClassLoader clazzLoader = new URLClassLoader(new URL[]url);
    Class clazz = clazzLoader.loadClass("com.ibm.db2.jcc.DB2Driver");
    System.out.println ("Success! --> " + clazz.newInstance().toString());
    String connectString = "jdbc:db2://dummy:34000/dev1";
    System.out.println("BEFORE CONNECTION");
    Connection conn =
    DriverManager.getConnection(connectString,"mario","123123");
    System.out.println("after CONNECTION");
    System.out.println("Driver Version - " + conn.getMetaData().getDriverVersion() + "
    catch (Exception ex)
    System.out.println ("In Exception Block -- Failed.");
    ex.printStackTrace (System.out);
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Here are the logging messages
    %%%% true
    %%%% true
    %%%% true
    Success! --> com.ibm.db2.jcc.DB2Driver@24442444
    BEFORE CONNECTION
    In Exception Block -- Failed.
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:186)
    at com.tdbfg.tdsecurities.kasper.admin.aboutkasper.JarFileLoader1.main(JarFileLoader1.java:61)

    kasper123 wrote:
    Hi
    I loaded my file successfully , but when I tried to use the driver to connect to the DB , I get
    java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
    Here is my class
    import java.net.URL;
    import java.io.IOException;
    import java.net.URLClassLoader;
    import java.net.MalformedURLException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.io.*;
    public class JarFileLoader1 extends URLClassLoader
    public JarFileLoader1 (URL[] urls)
    super (urls);
    public void addFile (String path) throws MalformedURLException
    String urlPath = "jar:file://" + path + "!/";
    addURL (new URL (urlPath));
    public static void main (String args[])
    try
    File f = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc.jar");
    System.out.println("%%%% " + f.exists());
    File f1 = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc_license_cu.jar");
    System.out.println("%%%% " + f1.exists());
    File f2 = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc4.jar");
    System.out.println("%%%% " + f2.exists());
    URL urls [] = {};
    JarFileLoader1 cl = new JarFileLoader1 (urls);
    cl.addFile ("E:\\db2_v9_5 FP5_drivers\\db2jcc.jar");
    cl.addFile ("E:\\db2_v9_5 FP5_drivers\\db2jcc_license_cu.jar");
    cl.addFile ("E:\\db2_v9_5 FP5_drivers\\db2jcc4.jar");
    URL url = new File("E:\\db2_v9_5 FP5_drivers\\db2jcc.jar").toURL();
    URLClassLoader clazzLoader = new URLClassLoader(new URL[]{url});
    Class clazz = clazzLoader.loadClass("com.ibm.db2.jcc.DB2Driver");
    System.out.println ("Success! --> " + clazz.newInstance().toString());
    String connectString = "jdbc:db2://dummy:34000/dev1";
    System.out.println("BEFORE CONNECTION");
    Connection conn =
    DriverManager.getConnection(connectString,"mario","123123");
    System.out.println("after CONNECTION");
    System.out.println("Driver Version - " + conn.getMetaData().getDriverVersion() + " ");
    catch (Exception ex)
    System.out.println ("In Exception Block -- Failed.");
    ex.printStackTrace (System.out);
    }================================================
    ====================================================
    Here are the logging messages
    %%%% true
    %%%% true
    %%%% true
    Success! --> com.ibm.db2.jcc.DB2Driver@24442444
    BEFORE CONNECTION
    In Exception Block -- Failed.
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:186)
    at com.tdbfg.tdsecurities.kasper.admin.aboutkasper.JarFileLoader1.main(JarFileLoader1.java:61)
    For debugging purposes you could use [DriverManager.getDrivers()|http://download.oracle.com/javase/6/docs/api/java/sql/DriverManager.html#getDrivers%28%29] to get an enumeration of all drivers
    and then output their names.
    Maybe, with the classloader malarkey you are doing
    you need to use [DriverManager.registerDriver(Driver driver)|http://download.oracle.com/javase/6/docs/api/java/sql/DriverManager.html#registerDriver%28java.sql.Driver%29]

  • Javabean for file up-/down-load to/from the database

    Dear all,
    Has anyone any experience in client-side customizing/extending
    through the use of standard JavaBeans or
    Pluggable Java Components (PJCs) within the Oracle (Web-)Forms
    Developer 6i environment? We want to realize the
    following:
    By using a Java Bean within a (Web-)Forms 6i client that is
    capable of file uploads to and file downloads from a database
    (end tier).
    Important requirement is to uploads/downloads files (BLOB, CLOB)
    directly to/from the database, NOT TO/FROM THE FILESYSTEM.
    We have found a sample JavaBean on
    http://otn.oracle.com/sample_code/products/forms/content.html.
    Unfortunately, this code is based on file transfering to/from
    the filesystem.
    Is there someone who did customizations enabling file
    uploads/downloads into/from the database? Are there any
    other suggestions?
    Please contact:
    Deep Nanda
    Developer
    Wolters Kluwer Academic Publishers
    The Netherlands
    email: [email protected]
    Thanks in advance,
    Deep

    I've not tried this out but in theory since a Java Bean is just
    a piece of Java code you could do this using JDBC. However,
    while you may have a valid reason for this, it really defeats
    the purpose of having a middle tier. The idea behind the web
    deployment is that the bulk of the application is on a powerful
    server which makes the client as light weight as possible. If
    you add more functionality to the client (which is not UI
    specific) then you will increase the download to the client, you
    will impact the system requirements for the client and you will
    probably make the application less scalable (think about if yu
    have 1000 clients with database connections for the middle tier
    and now all 1000 want to connect from the client as well - yuo
    double the access of the database)
    SO the short answer is Yes yuo can in theory - in practice I
    would be very careful in deciding to move this way.
    Regards
    Grant Ronald
    Forms Product Management

  • Unsigned jacob.jar file causing forms loading slow

    Dear All,
    Oracle version : 10.1.2.0.2
    OS: Windows 2003
    Client IE version : IE 8
    JRE version : JRE 1.6 update 21
    JRE security setting : Mixed code (sandboxed vs. trusted) security verification - Disabled
    We are getting the unsigned jar file error for jacob.jar, but it is running fine in many other places and giving unsigned jar file error for other jar files.
    Loaded image: jar:http://192.168.100.88:7778/forms/java/frmall.jar!/oracle/forms/icons/frame.gif
    Trace level set to 5: all ... completed.
    cache: Reading Signers from 0 http://192.168.100.88:7778/forms/java/jacob.jar | C:\Users\samm.AGS-STORE-005\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\48\dc408b0-3aabe349.idx
    network: No certificate info for unsigned JAR file: http://192.168.100.88:7778/forms/java/jacob.jar
    network: No certificate info for unsigned JAR file: http://192.168.100.88:7778/forms/java/jacob.jar
    network: Connecting http://192.168.100.88:7778/forms/lservlet;jsessionid=c0a8645830d6885b096494a44406bb10e869f532355e.e38LbhmPbxyKci0La3qPa3iNa38Re6fznA5Pp7ftolbGmkTy with proxy=DIRECT
    I have seen sites to sign the jar files, but is it possible to overcome this error without signing. Since this error is taking 10-20 secs more to load the form.
    Please help.
    Thanks and Regards,
    Anand.

    HI,
    You need to sign both frmwebutil.jar and jacob.jar first the clear JAR cache ion end-user computer,so that new signed JAR files are downloaded to end-user machines..

Maybe you are looking for

  • JMS Adapter to remote JMS Server in ESB??

    Has anyone successfully setup a JMS adapter in the ESB to talk to a JMS server on a remote host? We are using OC4J JMS and so I followed the instructions in section 5.2.1.7 in the Adapters guide on this. I updated the oc4j-ra.xml file. The guide didn

  • Date Diff Issues

    1. Subscriber – Employee Details has these three records 2. Call Details  has these two records My main goal is to populate date diff in table 1 as 1 if "work order check in date" >= 3 of Aspect calender date from the 2nd table. The Problem i am faci

  • MY reliable CS2 software tells me my 30day window to register has expired -- 8  years after installing

    Adobe Tech support sent me to a download of CS2 files but there appears to be no way to actually initiate the download...

  • Acknowledgements using Business Systems

    Hi: I am a XI developer, and I am dealing with a interface: SAP-(idoc)->  XI - (file)---->legacy I wanna have an acknowledgement from XI to SAP when the idoc have arrived to XI. My interface has Business Systems, we dont wanna Business services or BP

  • Does Bridge 5.1 support RAW files from Nikon D600 ?

    Does Bridge version  5.1 support RAW files from Nikon D600 ? latest available Camera Raw plugin 6.7 does not seem to recognize NEF fileds from D600