?
Solved

File IO Permissions (Microsoft Java VM)

Posted on 2003-03-08
12
Medium Priority
?
354 Views
Last Modified: 2010-03-31
I have written an applet which works perfectly if I compile and sign it using Suns SDK utilities. Though, I want it to run under Microsoft Java VM as well, but if I compile and sign the code using the MS SDK for Java 4.0 utilities, I get an exception when running the applet "com.ms.security.SecurityExceptionEx".

What the applet does is, it accesses a file on the users local harddrive. So I need IO R/W permissions.

How do I go about making my applet work under MS Java VM?

Thanks in advance.
0
Comment
Question by:NeuRo
[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
12 Comments
 
LVL 92

Expert Comment

by:objects
ID: 8095502
How do you sign the cab?
0
 
LVL 92

Expert Comment

by:objects
ID: 8095519
Should be something like:


REM First, create the CAB file. The arguments here are:
REM    -r        Recurse into subdirectories
REM    -p        Preserve path names
REM    -P [arg]  Strip the argument (here "%1\") from the beginning of each path
REM    N  [arg]  Create the given named .cab file
REM    [rest]    Put these files (here "%1\*.*") into the .cab file
REM Note! this does NOT use the -s option to reserve space for the signature;
REM the latest version of signcode (from the Java SDK 2.01) doesn't need this.
ECHO *********** About to create .cab archive using cabarc ***********
cabarc -r -p -P src\ N objects.cab src\*.class

REM Next, sign the code. Arguments are:
REM    -j javasign.dll    This provides the tools to do Java permission levels
REM    -jp  [arg]         The permission level to be used
REM    -spc [arg]         Software publishing certificate file
REM    -v   [arg]         Private key file
REM    -n   [arg]         Nice name of archive (shown in digital ID dialog)
REM    [arg]              Archive file to be signed (here "%1.cab")
ECHO *********** About to sign archive using signcode ***********
signcode -j javasign.dll -jp low -spc objects.spc -v objects.pvk -n au.com.objects.MyApplet objects.cab
0
 

Author Comment

by:NeuRo
ID: 8097259
objects:

Cheers for the reply.
The way I sign my cab file is:

PATH=%PATH%;C:\Program Files\Microsoft SDK For Java 4.0\Bin
jvc /g:l myApplet.java
cabarc N myApplet.cab myApplet.class
makecert -sk myApplet -n "CN=NeuRo" myApplet.cer
cert2spc myApplet.cer myApplet.spc
signcode -j JavaSign.dll -jp High -spc myApplet.spc -k myApplet -n "myApplet" -i http://www.xxx.dk/ myApplet.cab

It is some what like  the way you do it ... Though, I don't have the same options as you in the cabarc. In signcode i use -jp High - should it be low to have the correct IO Permissions?
0
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!

 

Author Comment

by:NeuRo
ID: 8097264
I should not make any corrections to my Java code, right? I should be able to use the exact same code with Suns JRE and Microsofts JVM, am I right?
0
 
LVL 92

Expert Comment

by:objects
ID: 8099220
> I should not make any corrections to my Java code, right?

correct.

> I should be able to use the exact same code with Suns
> JRE and Microsofts JVM, am I right?

correct, but one will run a cab, the other a jar.

what does your html look like?

0
 

Author Comment

by:NeuRo
ID: 8101552
My HTML looks like this:

<APPLET MAYSCRIPT="true" ID="JRK" NAME="JRK" CODE="myApplet.class" WIDTH=100 HEIGHT=100>
<PARAM name="cabbase" VALUE="myApplet.cab">
</APPLET>
0
 

Author Comment

by:NeuRo
ID: 8101578
My HTML looks like this:

<APPLET MAYSCRIPT="true" ID="JRK" NAME="JRK" CODE="myApplet.class" WIDTH=100 HEIGHT=100>
<PARAM name="cabbase" VALUE="myApplet.cab">
</APPLET>
0
 

Author Comment

by:NeuRo
ID: 8102437
I actually got the thing working now .. Or .. Almost that is. I can run my methods to read/write the file from within my applet, but as soon as I try to access my methods from JavaScript I get this security exception: "com.ms.security.SecurityExceptionEx[Unknown]: cannot access the file c:\test.txt"

The funny thing is that when I compiled and signed it with Suns tools I could run these methods from JavaScript, which is the whole point of my applet. But how come I can't do it when it is compiled and signed with Microsofts tools???

0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 8106548
> I can run my methods to read/write the file from within my applet

What did u change?

> as soon as I try to access my methods from JavaScript

are you saying if you call the applet from js u get an exception, but not if the applet runs the method directly.

> I compiled and signed it with Suns tools

How did you create cab using Sun tools?

0
 

Expert Comment

by:CleanupPing
ID: 9058843
NeuRo:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 35

Expert Comment

by:girionis
ID: 9693319
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to objects

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
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 …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

764 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