Filepermisson on jar files

P

Pedro Pinto

Hi there!

I've build an Java applet which uses the jxl.jar file, named app.jar.
Jxl for who haven't heard is the jar that constains the classes for
excel file editing. The issue here is, app.jar has two java applets,
one for the excel file creation and another for the application
settings. The applet for the application settings works well and can
read/write files to/from the local hard drive. I've signed the
app.jar. The issue here is when i launch the main java applet for the
excel file creation exceptions are thrown, indicating that jxl doesn't
have read/write permissons. I've tried signing the jxl.jar but it
still gives me the same errors. When signing i tried using the app.jar
key already generated or a new key but didn't work. Can anybody give
me a clue on how i can solve this. Thanks in advance for any help.

app.jar -> signed and launches well in IE7.
jxl.jar -> when performing the convertion indicated that doesn't have
read/write permissions.
 
A

Andrew Thompson

Pedro Pinto wrote:
...
I've build an Java applet ...

Considered launching your applet using web start?
<http://www.physci.org/jws/#jtest>
It might ..
a) solve the permissions problem.

..or at least offer alternate strategies, such as..
... The applet for the application settings works well and can
read/write files to/from the local hard drive. ...

b) A *sandboxed* web start app. can access files on the
local PC using the JNLP API's FileOpen/SaveService.
<http://www.physci.org/jws/#fs>

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
 
P

Pedro Pinto

I think the trick in solving this issue is to have both jar files
signed with the same jarsigner but i can't seem to be able to do this.
 
R

Roedy Green

app.jar -> signed and launches well in IE7.
jxl.jar -> when performing the convertion indicated that doesn't have
read/write permissions.
I would suggest reading it with getResource and getResource as stream.
Applets can't go opening arbitrary local jars unless the Applet itself
is signed.
 
J

javayahtzee

I think the trick in solving this issue is to have both jar files
signed with the same jarsigner but i can't seem to be able to do this.

If you can give me a link to an explanation of the signing process I
might be able to figure out what needs to be done.
 
P

Pedro Pinto

I would suggest reading it with getResource and getResource as stream.
Applets can't go opening arbitrary local jars unless the Applet itself
is signed.


But the applet is signed! Initially it wasn't so it wouldn't start
because it has to read data from a local file. But after signing it it
starting working well, expect when it has to use the classes of the
jxl.jar. For example, i can read and write well with the program
settings file but when trying to open an excel file an error occurs
indicating that jxl doesn't have enought permissions. I also tried to
sign the jxl package but, i don't know why, when i start the applet
the browser never indicates that i need to accept the digital
signature, thus, never aproving jxl.jar package for use. Is there a
way to manually insert the digital signature in the aprove list? Has
an alternative, how can i get the jxl package working inside the
app.jar? Has last possible solution, how can i put the two jar files
using the same digital signature?

Regards and thank you for the support
 
P

Pedro Pinto

Hello again to everyone!

After a good weekend rest i sat in front of my pc and in 20 minutes
solved my issue. What did i do:

1 - Close all IE windows open. If i didn't do this it wouldn't really
refresh the certificate attemps and would never accept the new
certificates issued.

2 - Followed the specified commands:

keytool -genkey -keyalg rsa -alias yourkey
keytool -export -alias yourkey -file yourcert.crt
javac yourapplet.java
jar cvf yourapplet.jar *.class
jarsigner yourapplet.jar yourkey

inserted the following tag:

<applet code="yourapplet.class" archive="yourapplet.jar" width="600"
height="500">
</applet>


The trick was to sign with the same certificate both jar packages and
afterwards it would work well.

This was a messy situation only by the fact that i wasn't closing the
IE windows.

In regard of the question why not use jnlp, i'm starting a course
about it and expect to start using rapidly. If someone has some
information about good books or tutorials please advise. Thanks in
advance for all the help.

Regards

Pedro Pinto
 
A

Andrew Thompson

Pedro Pinto wrote:
...
In regard of the question why not use jnlp, i'm starting a course
about it and expect to start using rapidly.

You will never look back. Note that web start would
not have been tripped up by the 'cache' behaviour of IE.
...If someone has some
information about good books or tutorials please advise.

Java Tutorial - Deploying Java Web Start Applications
<http://java.sun.com/docs/books/tutorial/deployment/webstart/deploying.html>
<http://java.sun.com/docs/books/tutorial/deployment/webstart/index.html>

Java Web Start - Developers Section
<http://java.sun.com/products/javawebstart/developers.html>

JNLP File Syntax
<http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html
JNLP API Reference 1.5 - if you're interested in using JNLP
API Services to 'break out' of the sandbox for otherwise 'no
permissions' apps - this is where to look first, though there
are some nice buildable examples of the JNLP API at PhySci.
<http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/index.html>

Web Start v 1.5 - FAQ
<http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq.html>

Unofficial Java Web Start-JNLP FAQ (whispers) ..better than Sun's own.
<http://lopica.sourceforge.net/faq.html>

PhySci web start examples. ..better than Sun's own.
<http://www.physci.org/jws/>

Sun web start examples (OK, more apps. that just happen
to be launched by web start, but some of them show interesting
aspects of it..)
...Thanks in advance for all the help.

Your apprecaiation is best expressed in your future lack
of top-posting. More details here..
<http://www.physci.org/codes/javafaq.html#toppost>

HTH

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top