Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Java
  4. Applet giving access denied exception

Applet giving access denied exception

Scheduled Pinned Locked Moved Java
sysadmin
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fahim A Salim
    wrote on last edited by
    #1

    Hi Following the code of my applet

    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("C:\\Program Files\\eSpeak\\command_line\\espeak.exe \"This is a text\"");
    int exitValue = proc.waitFor();

    while the program is on the server the applet run fine when i call the page on my machine but when the web page is called on some other machine it gives access denied exception i have set the permission on my jre but still no sol.

    A 1 Reply Last reply
    0
    • F Fahim A Salim

      Hi Following the code of my applet

      Runtime rt = Runtime.getRuntime();
      Process proc = rt.exec("C:\\Program Files\\eSpeak\\command_line\\espeak.exe \"This is a text\"");
      int exitValue = proc.waitFor();

      while the program is on the server the applet run fine when i call the page on my machine but when the web page is called on some other machine it gives access denied exception i have set the permission on my jre but still no sol.

      A Offline
      A Offline
      adatapost
      wrote on last edited by
      #2

      Applets are inheritly secured. You cannot execute process, perform I/O, database action with applets under nornal security manager settings. To do so, create your security manager and a policy file.

      A DATAPOST COMPUTER CENTRE (K.V Prajapati)

      F 1 Reply Last reply
      0
      • A adatapost

        Applets are inheritly secured. You cannot execute process, perform I/O, database action with applets under nornal security manager settings. To do so, create your security manager and a policy file.

        A DATAPOST COMPUTER CENTRE (K.V Prajapati)

        F Offline
        F Offline
        Fahim A Salim
        wrote on last edited by
        #3

        but will how will i tell the applet that the particular file is on the server file system not on the client. and currently with the code above where does the applet look for the file under normal circumstances.:confused:

        N 1 Reply Last reply
        0
        • F Fahim A Salim

          but will how will i tell the applet that the particular file is on the server file system not on the client. and currently with the code above where does the applet look for the file under normal circumstances.:confused:

          N Offline
          N Offline
          Nagy Vilmos
          wrote on last edited by
          #4

          Further to the original answer. An applet is sandboxed when running on the client. The runtime allows it to 'phone home', but AFAIK that is it. You cannot run an external process from an applet. Not at all. It's breaks the runtime. And then puppies die. :(


          Panic, Chaos, Destruction. My work here is done.

          F 1 Reply Last reply
          0
          • N Nagy Vilmos

            Further to the original answer. An applet is sandboxed when running on the client. The runtime allows it to 'phone home', but AFAIK that is it. You cannot run an external process from an applet. Not at all. It's breaks the runtime. And then puppies die. :(


            Panic, Chaos, Destruction. My work here is done.

            F Offline
            F Offline
            Fahim A Salim
            wrote on last edited by
            #5

            I was anticipating that so that is why I started this approach using a servlet below is code of my servlet response The process I Called give the audio wave file on console which i read and and now sending it as response but the audio is not hear able at the client I know I am making a mistake here but don't know where and i tried so many things can you help

               response.setContentType("audio/x-wav");
                PrintWriter out = response.getWriter();
                try 
                   {
                      String line;
            
                   Runtime rt = Runtime.getRuntime();
                   Process proc = rt.exec("C:\\\\Program Files\\\\eSpeak\\\\command\_line\\\\espeak.exe --stdout \\"This is a text\\"");
            
                   AudioInputStream adstream= (AudioInputStream)proc.getInputStream();
                   byte\[\] b= new byte\[512\];
                   int bytes=0;
            
                   while ( (bytes = adstream.read(b)) != -1 )
                            {
                            for(int i=0;i<bytes;i++)
                                {
                                out.print(b\[i\]);
            
                                }
            
            N 1 Reply Last reply
            0
            • F Fahim A Salim

              I was anticipating that so that is why I started this approach using a servlet below is code of my servlet response The process I Called give the audio wave file on console which i read and and now sending it as response but the audio is not hear able at the client I know I am making a mistake here but don't know where and i tried so many things can you help

                 response.setContentType("audio/x-wav");
                  PrintWriter out = response.getWriter();
                  try 
                     {
                        String line;
              
                     Runtime rt = Runtime.getRuntime();
                     Process proc = rt.exec("C:\\\\Program Files\\\\eSpeak\\\\command\_line\\\\espeak.exe --stdout \\"This is a text\\"");
              
                     AudioInputStream adstream= (AudioInputStream)proc.getInputStream();
                     byte\[\] b= new byte\[512\];
                     int bytes=0;
              
                     while ( (bytes = adstream.read(b)) != -1 )
                              {
                              for(int i=0;i<bytes;i++)
                                  {
                                  out.print(b\[i\]);
              
                                  }
              
              N Offline
              N Offline
              Nagy Vilmos
              wrote on last edited by
              #6

              The idea is coming, so no hiding behind the door: An 'applet' is mini-applicatation that can be inside a webbrowser. An 'agglet' is an agile applet that can reproduce itself and move around; but still sandboxed. A 'servlet' is a small server-side applicatation. Now, you've got a servlet creating, psssible, an audio stream. The stream is returned to the applet and the applet does what exactly? BTW I would be very VERY suprised if the code, as written, is actually getting the audio stream.


              Panic, Chaos, Destruction. My work here is done.

              F 1 Reply Last reply
              0
              • N Nagy Vilmos

                The idea is coming, so no hiding behind the door: An 'applet' is mini-applicatation that can be inside a webbrowser. An 'agglet' is an agile applet that can reproduce itself and move around; but still sandboxed. A 'servlet' is a small server-side applicatation. Now, you've got a servlet creating, psssible, an audio stream. The stream is returned to the applet and the applet does what exactly? BTW I would be very VERY suprised if the code, as written, is actually getting the audio stream.


                Panic, Chaos, Destruction. My work here is done.

                F Offline
                F Offline
                Fahim A Salim
                wrote on last edited by
                #7

                well let say it is because --stdout switch makes the program called to send the wav file on the console instead of writing it to file now it is on the console but the problem is to send it to ahead and their is some problem can you identify it? "BTW I would be very VERY suprised if the code, as written, is actually getting the audio stream." so if you have identified the problem can you tell me where it is:confused:

                N 1 Reply Last reply
                0
                • F Fahim A Salim

                  well let say it is because --stdout switch makes the program called to send the wav file on the console instead of writing it to file now it is on the console but the problem is to send it to ahead and their is some problem can you identify it? "BTW I would be very VERY suprised if the code, as written, is actually getting the audio stream." so if you have identified the problem can you tell me where it is:confused:

                  N Offline
                  N Offline
                  Nagy Vilmos
                  wrote on last edited by
                  #8

                  Faheem A Saleem wrote:

                  well let say it is because --stdout switch makes the program called to send the wav file

                  If that is really the case then it might work. What I would suggest is that you create the audio streams required on the server and feed them to the applet. The applet can then play the audio; that I would need to google... ...done it[^]


                  Panic, Chaos, Destruction. My work here is done.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups