ahbrahim2's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
58 (0.02 per day)
Joined:
21-September 09
Profile Views:
3,605
Last Active:
User is offline Mar 24 2014 07:14 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0

Latest Visitors

Icon   ahbrahim2 has not set their status

Posts I've Made

  1. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View Postx68zeppelin80x, on 24 March 2014 - 12:56 AM, said:

    Try using the ClassLoader from your class:
    java.net.URL url = getClass().getClassLoader().getResource("audio/am.au");
    System.out.println(url)
    


    You should see something print out like:

    file:/C:/Users/ahbrahim2/path/to/project/com/exercises/audio/am.au

    No I didn't even try to print the url. also i didn't create an html for .I just want to use the applet viewer.
  2. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View PostStrongJoshua, on 24 March 2014 - 12:36 AM, said:

    Make sure the audio folder is in the same folder as your class files. Then, if that's correct, try putting a backwards slash "/" in front of the folder name. I haven't programmed in Java in a while so I don't remember how ClassLoader works, so I don't know if the slash is necessary, but try it anyway.

    All I have to do is to move the audio file in the same directory as thr .class file without any extra"/". Hey Thanks a lot for the adivise.
  3. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View Postahbrahim2, on 24 March 2014 - 12:27 AM, said:

    View PostStrongJoshua, on 23 March 2014 - 11:58 PM, said:

    Seeing as the error is pointing to line 20 in the ClockWithAudio class there must be something wrong with the line
    Applet.newAudioClip(this.getClass().getResource("audio/am.au"));
    
    Also, it is a nullPointerException meaning something in that line of code must be null. Since this.class will not likely ever be null it would have to be either the Applet.newAudioClip method or the audio file you are referencing. Since the error message indicates that the code went into the newAudioClip method the only thing left is the resource you are referencing. Make sure that that file is within the correct folder and everything is named exactly as it is supposed to be!
    Hope this helps :)/>/>

    I checked and everything seems to be correct. Where the audio file should be? I have in the exercise folder!Also I've added another "/" eventhough I don't think I need it. but still showing me the same error.
  4. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View PostStrongJoshua, on 23 March 2014 - 11:58 PM, said:

    Seeing as the error is pointing to line 20 in the ClockWithAudio class there must be something wrong with the line
    Applet.newAudioClip(this.getClass().getResource("audio/am.au"));
    
    Also, it is a nullPointerException meaning something in that line of code must be null. Since this.class will not likely ever be null it would have to be either the Applet.newAudioClip method or the audio file you are referencing. Since the error message indicates that the code went into the newAudioClip method the only thing left is the resource you are referencing. Make sure that that file is within the correct folder and everything is named exactly as it is supposed to be!
    Hope this helps :)/>

    I checked and everything seems to be correct. Where the audio file should be? I have in the exercise folder!

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

ahbrahim2 has no profile comments yet. Why not say hello?