Solved

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

Posted on 2002-07-18
2
816 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
[X]
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
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

726 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