Solved

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

Posted on 2002-07-18
2
803 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
Comment Utility
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
Comment Utility
Points refunded and placed in PAQ

Computer101
E-E Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now