Solved

How: grant AllPermission to applet in Forte or Netbeans launched in appletviewer.exe by f6

Posted on 2002-07-18
2
811 Views
Last Modified: 2007-12-19
I have an applet that's ultimately intended to run as a signed applet via the 1.4 Java Plug-in (it requires access to the system clipboard and needs 1.4 because clipboard image transfers don't work with older versions).

Adding the "grant AllPermission" to "c:\program files\java\j2re1.4.0_01\lib\security\java.policy" made it run fine via the JPI under Internet Explorer from an object tag embedded in a html page and served via Forte's built-in Tomcat.

The problem is that I can't get it to run in appletviewer.exe if I launch it via f6 in Forte.

The applet's source code is in "d:\java\clipapplet", as are the compiled class files. I'm trying to grant AllPermission to any applet launched from d:\java and its subdirectories.

I tried to add the following grant directive to "c:\j2sdk1.4.0_01\jre\lib\security\java.policy" (NOTE -- not the same java.policy file as above):

grant codeBase "file:/D:/java/-" {
  permission java.security.AllPermission;
};

but it didn't make any difference. Launching the applet into appletviewer.exe via f6 still throws a security exception.

I'm not sure whether I'm adding the "grant" to the wrong file, using the wrong syntax, Forte itself is overriding/explicitly specifying a different properties file altogether, or perhaps Forte is launching the applet from a temp directory somewhere besides d:\java.

So... what, exactly, do I need to do to grant AllPermission to the applet when it runs in appletviewer when launched from Forte using f6?

Forte's ide.cfg file has the following line:
-jdkhome C:\j2sdk1.4.0_01 -J-Xmx96m -J-Xss1024k -J-Xms24m -J-Xverify:none
0
Comment
Question by:jskubick
2 Comments
 

Author Comment

by:jskubick
ID: 7165113
Well, after several hours of brute force experimentation, I managed to conclusively verify several things and ultimately solve the problem.

1. The relevant file WAS c:\j2sdk1.4.0_01\jre\lib\security\java.policy (corresponding to the -jdkhome parameter in forte's ide.cfg file).

2. The policy file IS consulted each time appletviewer launches an applet. In other words, it's NOT read one time and cached until the next system restart.

These two conclusions were actually confirmed by a typo I made in the java.policy file that resulted in the display of an error message in Forte's output window when launching the applet for the Nth time.

3. This is the big one. Appletviewer sees the applet as having been accessed via http from the local machine, but the following URLs will NOT match as codeBase parameters:

http://localhost/-
http://127.0.0.1/-
http://-

So what's the RIGHT answer? If you're running Windows XP (and presumably Win2k), it's your machine's "full computer name" (right click "My Computer", choose "properties", then go to "Computer Name". In my case, the value there is "jeff.", so the following codeBase parameter ultimately worked:

grant codeBase "http://jeff/-"

Grrrrr.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 7165230
Points refunded and placed in PAQ

Computer101
E-E Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 99
Java exception bubble up 2 24
Android development question 2 79
Glassfish admin console not working 1 59
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question