File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Testing applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Testing applets" Watch "Testing applets" New topic

Testing applets

Drew Chamberlain

Joined: Dec 08, 2008
Posts: 2
I am trying to convert an application to an applet and want to test it easily inside eclipse. The problem is that when I run it, the generated java.policy.applet file grants all permissions. Any ideas on how to run the applet within eclipse (or any ide/appletviewer/etc, just not a fully deployed setup), but with the same permissions it would have in a sandboxed, web browser environment? I tried editing the java.policy.applet to grant no permissions, but it looks like that is too restrictive...

Any help or links to articles that would help me dig into this would be appreciated.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39547
Welcome to JavaRanch.

Why not test it in appletviewer? All you need is an HTML file with the applet tag (actually, the applet tag is all the file needs to contain). Browsers can also open local HTML file containing applets; they don't need to be served from somewhere.

Ping & DNS - updated with new look and Ping home screen widget
Drew Chamberlain

Joined: Dec 08, 2008
Posts: 2
Originally posted by Ulf Dittmer:

Why not test it in appletviewer?

OK, that helps. It looks like I misunderstood the errors I was getting to be an appletviewer issue, but it was an eclipse problem. When you debug in eclipse, it seems to be creating the security file, then running the appletviewer. When you just run the appletviewer, it will run with the proper rights. I will look into a way to configure eclipse or just run the appletviewer. Thanks.
I agree. Here's the link:
subject: Testing applets
Similar Threads
Checking admin permissions from java applet
Writing a file and executing
File Upload Applet
How to run a .jar in a browser
Using Policy File