0

java.lang.SecurityException: Permission denied: file:////Videos/public/scripts/screenshot.jarアプレットを使用しようとすると、エラーが発生します。

アプレットのコードは次のとおりです。

<applet code="Screenshot" archive="file:////Videos/public/scripts/screenshot.jar" width="100px" height="100px">
</applet>

どうすれば修正できますか? また、問題の意味は何ですか?

編集:

私が見たところ、アプレットに署名する必要があります。誰かがこれがどのように、そしてなぜ行われるのか説明できますか? 提供されたサイトは、私がこれを自分のサイトに埋め込んでいて、すべてのクライアントがそれを使用し、何も署名する必要がないという事実に対処していないため、それを説明するのに悪い仕事をしています. 実行をクリックするだけです。

EDIT2:

アプリ自体のコード:

/*
By Bavo Bruylandt (Http://www.realapplets.com")

*/

// and now The inevidable "Hello World" example :)

// tell the compiler where to find the methods you will use.
// required when you create an applet
import java.applet.*;
// required to paint on screen
import java.awt.*;


// the start of an applet - HelloWorld will be the executable class
// Extends applet means that you will build the code on the standard Applet class
public class Screenshot extends Applet
{

// The method that will be automatically called  when the applet is started
     public void init()
     {
 // It is required but does not need anything.
     }


// This method gets called when the applet is terminated
// That's when the user goes to another page or exits the browser.
     public void stop()
     {
     // no actions needed here now.
     }


// The standard method that you have to use to paint things on screen
// This overrides the empty Applet method, you can't called it "display" for example.

     public void paint(Graphics g)
     {
 //method to draw text on screen
 // String first, then x and y coordinate.
      g.drawString("Hey hey hey",20,20);
      g.drawString("Hellooow World",20,40);

     }

} 
4

1 に答える 1

0

それはすべて、アプレットが何をしようとしているかに依存します。たとえば、ファイルシステムにアクセスするかどうかです。それは署名されたアプレットですか?アプレットは、デフォルトでは、権限が制限された特別なサンドボックスで実行されます。アプレットのセキュリティに関する詳細情報を確認する必要があります。まず、次の Informit の記事を参照してください: http://www.informit.com/articles/article.aspx?p=433382&seqNum=2

編集:

ポリシーファイルを追加してみてください。

/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/
  /* DO NOT EDIT */

   grant {
     permission java.security.AllPermission;
   };

などの名前。java.policy.applet をクラスパスに配置します。ポリシー ファイルに関するこの質問をご覧ください: Java アプレット ポリシー ファイルを配置する場所は?

于 2012-02-15T08:04:15.947 に答える