Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:32:52+00:00 2026-06-09T08:32:52+00:00

I have been working on an audio player applet, and I am having a

  • 0

I have been working on an audio player applet, and I am having a problem with getting it to run in a web browser. It works perfectly in applet viewer in eclipse, but it doesn’t work when i try it in Google Chrome. I even tried the generated applet file that eclipse makes, but it doesn’t work either, probably something to do with the way eclipse runs it.

this is the html file, but it isn’t allowed to access the mp3 files, or the special font i made:

<html>

<meta http-equiv="Content-Type" content="text/html; charset=MacRoman"/>

<body>

<applet code="DOSPlayer.class" archive="DOSPlayer.jar, basicplayer3.0.jar, commons-logging-1.1.1.jar, mp3spi1.9.5.jar, tritonus_share-0.3.6.jar, jl1.0.1.jar" width="450" height="350" >

</applet>

</body>

</html>

The error i am getting is because it can’t access the files because of access permissions:

java.security.AccessControlException: access denied (java.io.FilePermission fonts\DOSFont.ttf read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkRead(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at DOSPlayer.initFont(DOSPlayer.java:398)
    at DOSPlayer.<init>(DOSPlayer.java:413)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.reflect.InvocationTargetException
    at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission mp3 read)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkRead(Unknown Source)
    at java.io.File.list(Unknown Source)
    at java.io.File.listFiles(Unknown Source)
    at DOSPlayer.getFiles(DOSPlayer.java:259)
    at DOSPlayer.<init>(DOSPlayer.java:415)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Exception: java.lang.reflect.InvocationTargetException

I know that the error is coming from these two snippets of code:

     //path is "mp3/"
public String[] getFiles(String path) {

              String[] songs = new String[501];
              String files;
              File folder = new File(path);
              File[] listOfFiles = folder.listFiles(); 
              //gets all mp3 files within mp3 folder
             try {
              for (int i = 0; i < listOfFiles.length; i++) {

               if (listOfFiles[i].isFile()) 
               {
               files = listOfFiles[i].getName();
                    if (files.endsWith(".mp3")) {
                            songs[songNum] = files;
                            songNum++;
                            playableSongs++;
                    }
                 }
              }
             } catch (Exception e) {
                 System.out.println("Error Here");
                 e.printStackTrace();
                 return null;
             }
              return songs;


}

/////////////////////////////////

public void initFont() {
        try {
            //URL fontUrl = new URL("fonts/DOSFont.ttf");
            File file = new File("fonts/DOSFont.ttf"); // where ever it is from

            FileInputStream fontPath = new FileInputStream(file);
            dosFont = Font.createFont(Font.TRUETYPE_FONT, fontPath);//fontUrl.openStream());
            dosFont = dosFont.deriveFont(Font.PLAIN,19);
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            ge.registerFont(dosFont);
            font = true;
                } catch(Exception e) {
                    e.printStackTrace();
                    font = false;
                }
    }

I have already tried signing the applet, but that doesn’t work, it grants access to files on the person viewing the applet from a webpage. I also tried editing the policy file, and i can’t get that to work, but it can still be an option.

I have had trouble with this for hours and have no idea what to do, any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:32:55+00:00Added an answer on June 9, 2026 at 8:32 am

    These resources (especially the font) are effectively ‘application resources’ that could be added to a Jar and added to the run-time class path of the applet. If not in an archive, they should be added to a public place on the server (where they can be accessed directly from the browser).

    Once in a Jar or on the server, they can be accessed by URL. The URL can be formed as a relative path to the code or document base if not embedded in a Jar. If they are in a Jar, get an URL using something like:

    URL urlToFont = this.getClass().getResource("/path/in/jar/to/the.ttf");
    

    I also tried editing the policy file, and i can’t get that to work, but it can still be an option.

    No it can’t. Policy files are good for a very limited range of things, and a publicly deployed applet is not one of them.


    And just a quick comment on..

    File[] listOfFiles = folder.listFiles(); 
    

    That will need to be rethought. An applet cannot get a list of files on the server without help from the server. To define a group of files, an applet will typically have a parameter that accepts the paths/names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a jquery plugin that uses a HTML5 audio player
I have been working on reading in an audio asset using AVAssetReader so that
So I have been working on a few projects using audio and images from
I have been working on a web services related project for about the last
Have been working on this question for a couple hours and have come close
I have been working with SQL Server as a Developer a while. One thing
I have been working on a large java application. It is quite parallel, and
I have been working on this app for at least 3-4 months and just
I have been working on a project in C# (.net4). Project pretty much allows
I have been working on a project on and off, but I haven't touched

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.