Playing sound file without using Applet

Please Help me !
The code below shows an error " Cannot resolve symbol AudioClip"
What changes should be made??
import javax.swing.*;
import java.net.*;
import javax.sound.sampled.*;
import java.applet.AudioClip.*;
public static void main(String args[]) {
          AudioClip sound;
sound=JApplet.newAudioClip(new URL("file://C:\\jdk1.3\\bin\\Butfl_g.wav"));
     sound.play();
}

Sorry!Apology accepted.
I was in need of finding error as quickly as possible.
Thats why I tried to post it in here.No excuse for cross posting.
Please don't do it again.
db

Similar Messages

  • Playing sound files without using Applets

    Please Help me !
    The code below shows an error " Cannot resolve symbol AudioClip"
    What changes should be made??
    import javax.swing.*;
    import java.net.*;
    import javax.sound.sampled.*;
    import java.applet.AudioClip.*;
    public static void main(String args[]) {
              AudioClip sound;
    sound=JApplet.newAudioClip(new URL("file://C:\\jdk1.3\\bin\\Butfl_g.wav"));
         sound.play();
    }

    Also, the file protocol has 3. not 2 slashes."file://C:\\jdk1.3\\bin\\Butfl_g.wav"should be"file:///C:\\jdk1.3\\bin\\Butfl_g.wav"db

  • Error while playing sound file in Applet

    Hi!!
    I am trying to play sound file in the applet which produces sound continuously, when it goes above certain set value. When i run the sound file individually it runs perfectly fine but when i try to call that class in diff. program its giving me some security error..i am trying to solve this problem from last so many days..i dont know whether i have to make some change in Security file policy or java policy..the error is like..
    java.security.AccessControlException: access denied (java.util.PropertyPermissio
    n user.dir read)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:269)
    at java.security.AccessController.checkPermission(AccessController.java:
    401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
    at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
    76)
    at java.lang.System.getProperty(System.java:573)
    at SoundApplication.startLoadingSounds(SoundApplication.java:52)
    at SoundApplication.<init>(SoundApplication.java:42)
    at TempSet.actionPerformed(TempSet.java:103)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    86)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Please suggest some solution for this..its kinda urgent..
    Thanks in advance.
    Regards,
    Amish

    Are you loading your Applet from a webserver? You could make the sound file available through the same webserver.
    Alternatively, you could package the sound with the code in a JAR. It does mean a bigger download for your Applet users though, but the Applet would be able to access the file quickly.
    If you put your file in the JAR, say in /sound/myfile.ext , then you can get access to it from your code like this:
    URL soundURL = getClass().getResource( " /sound/myfile.ext" );

  • How do you open/play a .wav file (music file) without play sound file .vi

    I am having big problems to create a music background for my project. I am newbie using labview and maybe my questions is not so dificult to solve (I hope so)
    I was using play sound file vi but the problem is that I dont want the music file start automatically. I wanna control the start time using a button. I tried include a sound output stop but when the app start and I add more wav files in my vi, the sound file start, then stop abruptally because the stop vi and the everything is normal. I would like to eliminate that error.
    Someone have any idea, maybe using open file or another way. 
    Thanks in advance
    I add a screenshot of my vi and also the vi in this post
    Attachments:
    test sound.vi ‏11 KB

    I leave an example that can provide, use it in your program
    Atom
    Certified LabVIEW Associate Developer
    Attachments:
    playsound.zip ‏58 KB

  • What's the best solution for audio out of sound files from a MacBook Air to both an amplifier and to a subwoofer amplifier? I'm using the MBA to play sound files for worship services at our church.

    I have a MacBook Air (13", 1.7GHz, 8GB RAM, 500GB SSD) that I'll be using to play sound files (primarily organ and piano) for worship services at my church. We'll be using a QSC RMX2450 650 Watts/Channel amplifier with Community CPL-27 speakers and also a JBL SUB 250P powered subwoofer with its own amplifier. What's the best option for getting sound out from the Mac to both of these amplifiers? 

    if you work with own recorded sounds you might wanna have a music program where you want to work with samples, steinberg has got very good ones (so they say)... but their really really ( ²) expensive(that's why almost no one haves them), magix haves good ones too bu their more for 'unprofessional' use, ableton haves really good ones too and they're not to difficult to use (if you know a bit of those programs you learn very quickly) and if you don't get them, there is a sort of manual built in it which explains and lets you do things to start (basics)
    i hope this helped, btw stereo speakers are always better if you buy good ones (no pc speakers), but if you don't think you need them, don't buy them...
    so again, i hope you have some ideas now

  • Unable to load/play sound files using SoundEngine_LoadEffect

    Hi All,
    I am able to load/play sound files using SoundEngine_LoadBackgroundMusicTrack but unable to load/play sound files using SoundEngine_LoadEffect on iPhone Simulator. I am using the SoundEngine.h/cpp from Crash Landing. Oddly enough sound effects load and play succesffully when i start the app with 'Start with Performance Tool'. Does anyone know what is actually going on.
    Also i would like to know what is the difference between playing sound files using these two methods. What are the restrictions on individual sound file types for each method.
    Thanks

    I was able to load/run the sound effects after using Simulator - iPhoneOS 2.1 in the Active Target/Build drop down on Xcode toolbar. Both Active SDK, and Active Executable should be 2.1 in order to play the sound effects.

  • Is there any way to force the applet to load the file without using cache?

    Hi,
    I have the applet that renders some data from a file specified as the parameter. The problem is that the user can do something, that changes the input file and reloads the page, but the applet renders old data (from browser cache most probably)
    Is there any way to force the applet to load the file without using cache?
    Regards,
    Zdenek

    The initial view (IV) settings within a PDF file are static tags - they can't be made to dynamically-adapt based on the window dimensions,it's the renderer (Acrobat, Reader, or whatever else is opening the file) that decides if and how it will follow the IV requested by the file header.
    It would be possible to use a Page Open action on the first page of the file, which does some nasty math with the various doc.*WindowRect objects to work out how much "wasted" space there is, and then set the doc.layout and doc.zoomType properties - but page actions are a different concept to IV as the zoom will reset itself every time that page is viewed. Users don't like their application apparently fiddling with the zoom level without being told to!

  • Flash CS6 cant open play SWF files without importing and destroying them, how can I get around this?

    Flash CS6 can't open play SWF files without importing and destroying them, how can I get around this?
    I'm just trying to preview an swf file in flash like I have with all previous versions.

    What if my SWF loads external content from an online server?
    Not only does the current flash player prohibit such activity, it doesn't even pop open an error anymore saying there was an error connecting to an online source.
    Normally, I would simply drag the SWF into Flash and all connections would go through.  I could see traces, errors, and experience no issues.
    Now I can't even do that.  So what then?  You have crippled a fundamental use of the program, but THANK GOD we have that deco brush that nobody asked for.
    And for the record, the nature of my work benefits from not necessarily allowing the Flash Player to connect to online content.  The error it pops up?  That's simply another method of error checking that I require.  Updating the Flash Player options is not an option.
    Why would you even remove this key feature from Flash anyways?  It's been there for years ... has the ratio of people importing SWFs (a rather useless gesture in an increasing OOP world) really outweighed the people using Flash as a testing environment that much?

  • Interactive play sound file.vi crashs labview

    While playing with a *.wav file to perform an FFT on the data, I tried running this VI. Labview then crashes. No error.

    Which version of LabVIEW are you using?  I'm using LabVIEW 2011 SP1, and I ran the "Interactive Play Sound File.vi" from the example finder and the VI worked for me.  
    Are you just trying to play a sound file in your own VI?  If so, the DLL library call from the example could be causing the crash.  It could also be that your program isn't crashing, but just terminating before your sound file has a chance to play.
    There is an easier way to play a sound file, just use the "Play Sound File.vi".  You may also need to use the "Sound Output Wait.vi" to prevent your LabVIEW program from terminating before the sound has a chance to play.  I've attached a picture of the setup I'm refering to.
    Product Support Engineer
    National Instruments
    Attachments:
    sound_snippet.png ‏14 KB

  • How to open a text file without using dialog box

    I can open a file using dialog box but I want to open a file without using any dialog box for writing.
    With the following commands a new file is created.
    File outputFile = new File("outagain.txt");
    FileWriter out = new FileWriter(outputFile);
    I want to open an existing file and put some more text in it using FileWriter or any other object
    rgds,
    Arsalan

    import java.io.*;
    class UReader
        BufferedReader in;
        BufferedReader input;
        String fileName;
        public UReader(String fileName)
            this.fileName = null;
            this.fileName = fileName;
            try
                in = new BufferedReader(new FileReader(fileName));
                input = new BufferedReader(new FileReader("A.b"));
            catch(IOException _ex) { }
        public final String getContent()
            String txt = "";
            try
                while(in.ready())
                    txt = txt + in.readLine();
                    txt = txt + "\n";
                in.close();
                txt.trim();
            catch(IOException _ex) { }
            return txt;
        public final String getLine(int row)
            try
                input = new BufferedReader(new FileReader(fileName));
            catch(IOException _ex) { }
            String txt = null;
            if(row <= getRows()) {
                try
                    for(int i = 0; i < row; i++)
                        txt = input.readLine();
                    input.close();
                catch(IOException _ex) { }
            } else {
                txt = "Index out of Bounds";
            return txt;
        public final int getRows()
            try
                input = new BufferedReader(new FileReader(fileName));
            catch(IOException _ex) { }
            String txt = null;
            int rows = 0;
            try
                while(input.ready())
                    txt = input.readLine();
                    rows++;
                input.close();
            catch(IOException _ex) { }
            return rows;
    import java.io.*;
    import java.util.*;
    class UWriter
        PrintWriter out;
        String fileName;
        String[] txt;
        static int NEW_LINE = 1;
        static int APPEND = 0;
        public UWriter(String s)
            fileName = null;
            txt = null;
            fileName = s;
            try
                out = new PrintWriter(new BufferedWriter(new FileWriter(s, true)));
            catch(IOException ioexception) { }
        public final void addContent(String s, int i)
            int l = 0;
            StringBuffer sb = new StringBuffer(s);
            s.replaceAll("\n\n", "\n###\n");
            StringTokenizer str = new StringTokenizer(s, "\n");
            String token = null;
            while (str.hasMoreTokens()) {
                ++l;
                token = str.nextToken();
            str = new StringTokenizer(s, "\n");
            txt = new String[l];
            int k = 0;
            String test;
            while (str.hasMoreTokens()) {
                test = str.nextToken();
                if (test.equals("###")) test = "";
                txt[k++] = test;
            if(i == 0) {
                try
                    for (int j = 0; j < txt.length; ++j) {
                        out.println(txt[j]);
                    out.close();
                catch(Exception ioexception) { }
            } else {
                try
                    out.println();
                    for (int j = 0; j < txt.length; ++j) {
                        out.println(txt[j]);
                    out.close();
                catch(Exception ioexception1) { }
        public final void writeContent(String s)
            int l = 0;
            s.replaceAll("\n\n", "###");
            StringTokenizer str = new StringTokenizer(s, "\n");
            String token = null;
            while (str.hasMoreTokens()) {
                ++l;
                token = str.nextToken();
            str = new StringTokenizer(s, "\n");
            txt = new String[l];
            int k = 0;
            String test;
            while (str.hasMoreTokens()) {
                test = str.nextToken();
                if (test.equals("###")) test = "";
                txt[k++] = test;
            try
                PrintWriter bufferedwriter = new PrintWriter(new BufferedWriter(new FileWriter(fileName, false)));
                for (int j = 0; j < txt.length; ++j) {
                    bufferedwriter.println(txt[j]);
                bufferedwriter.close();
            catch(IOException ioexception) { }
    }Maybe they are not the best codes, i wrote them a long time ago, so dont ask why i did anything wierd. :D
    But anyway it works.

  • Regarding reading the data from the files without using Stremas

    hai to all of u...
    here i have a problem where i have to read the data from the files without using any streams.
    please guide me how to do this one,if possible by giving with an example
    Thanks & Regard
    M.Ramakrishna

    Simply put, you can't.
    By why do you need to?

  • Export table data in a flat file without using FL

    Hi,
    I am looking for options where I can export table data into a flat file without using FL(File Layout) i.e., by using App Engine only.
    Please share your experience if you did anything as this
    Thanks

    A simple way to export any record (table/view) to an csv fiel, is to create a rowset and loop through all record fields, like below example code
    Local Rowset &RS;
    Local Record &Rec;
    Local File &MYFILE;
    Local string &FileName, &strRecName, &Line, &Seperator, &Value;
    Local number &numRow, &numField;
    &FileName = "c:\temp\test.csv";
    &strRecName = "PSOPRDEFN";
    &Seperator = ";";
    &RS = CreateRowset(@("Record." | &strRecName));
    &RS.Fill();
    &MYFILE = GetFile(&FileName, "W", %FilePath_Absolute);
    If &MYFILE.IsOpen Then
       For &numRow = 1 To &RS.ActiveRowCount
          &Rec = &RS(&numRow).GetRecord(@("RECORD." | &strRecName));
          For &numField = 1 To &Rec.FieldCount
             &Value = String(&Rec.GetField(&numField).Value);
             If &numField = 1 Then
                &Line = &Value;
             Else
                &Line = &Line | &Seperator | &Value;
             End-If;
          End-For;
          &MYFILE.WriteLine(&Line);
       End-For;
    End-If;
    &MYFILE.Close(); You can of course create an application class for generic calling this piece of code.
    Hope it helps.
    Note:
    Do not come complaining to me on performance issues ;)

  • Upload file without using file upload UI Element

    Hi all.
    I need upload a .txt file without using file upload UI Element because filename is not insert by user. The filename is generated by program. I try to use 'GUI_UPLOAD' and 'WS_UPLOAD' but don't work.
    Many thanks in advance.

    As you correctly pointed out we cannot use the gui_upload and gui_download fm's in webdynpro because they require sap gui and WD Components generally run in a HTML or Portal environment.
    The only option available is File Upload Element

  • Saving a Text data to a PDF file without using print option

    Hi,
    I want to save a Text to a PDF file. I want to assign the path of the PDF file as a default one.
    If I use Print options, then it ask for the file path at the run time.
    Is there any method to save to a PDF file without using print option in Labview 8.2.
    Regards,
    Raja

    This question comes up a lot. Did you try searching? It depends on the PDF printer driver that you're using. See here, here, here, ...

  • Embed flash file without using IFrame UI

    Hi all,
    Can any one tell me how i can embed flash file without using IFrame UI ?

    Hi
    To run a flash file you will definetely need a platform for which you need a shockwave player or a simple browser window. From webdynpro, the purpose of making it run through a IFrame is at runtime, the frame acts as a window for the flash file to run. Hence its the direct option of running it. Otherwise, you need to use a external window to invoke it seperetely in a browser window to run the file.
    If you have any specific issues, do let us know, or else its the best option @!
    thanks
    sathya

Maybe you are looking for

  • In App FAQs

    Is the 1-week free trial available to In-App Purchase customers? Yes. The 1-week free trial is available to any new subscribers that are subscribing via the In-App Purchase option, including the Monthly pass that is only available to Android users. W

  • Dynamic Directory and File Naming in Receiver Adapter

    Hi ..My Receiver file should Look like this. COLCCYYMMDDHHMMSSLPMASTER___.tmp 1st 3 bytes: COL  ( Sender File name is COLMASTER.txt) Next 14 bytes is timestamp: CCYYMMHHMMSS Next 1 byte: L ( constant Value ) Next 1 byte: P/Q/D (Production/QA/Dvlp.. C

  • ECM - How to check eligiblity of  the employees for a comp review item

    Hi We have one requirement in Compensation management,  While creating the Budget structures I need to determine the Eligible employee population (For amount calculation) depending on the Compensation Review Item selected on the selection of the Cust

  • Var question

    Hi In the column i am restricting the product with customer exit var. For ex i am searching for 124  ( * cabn be  any number0-9). The code works fine if the result of the varialble exists. issue is if the result of the customer exit doesnot exists in

  • Finder crashes repeatedly since ML upgrade

    Since upgrading to ML Finder is constantly crashing. If I click the icon or try to open a window any other way, the finder bar comes up across the top briefly and then disappears. I have tried repairing permissions and doing a safe boot, which seemed