Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2002-07-18
2
810 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTTPSessionBindingListernter not configured in deployment descriptor 2 65
configure dependency in POM for new database 3 34
Java exception bubble up 2 21
Problem to Alipay 10 44
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

828 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