Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

Filepermisson on jar files

Thread view: 
Pedro Pinto - 10 Aug 2007 15:38 GMT
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.
Andrew Thompson - 10 Aug 2007 15:48 GMT
...
>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>

Signature

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

Pedro Pinto - 10 Aug 2007 15:58 GMT
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.
javayahtzee@gmail.com - 10 Aug 2007 17:25 GMT
> 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.
Pedro Pinto - 10 Aug 2007 18:16 GMT
On 10 Ago, 17:25, javayaht...@gmail.com wrote:

> > 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.

http://java.sun.com/developer/Books/javaprogramming/JAR/sign/signing.html

Thank you.

When i sign i perform the following commands:

keytool -genkey -alias app

jarsigner app.jar app
Roedy Green - 10 Aug 2007 17:24 GMT
>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.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Pedro Pinto - 10 Aug 2007 18:14 GMT
On 10 Ago, 17:24, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> >app.jar -> signed and launches well in IE7.
> >jxl.jar -> when performing the convertion indicated that doesn't have
[quoted text clipped - 6 lines]
> Roedy Green Canadian Mind Products
> The Java Glossaryhttp://mindprod.com

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
Andrew Thompson - 11 Aug 2007 01:01 GMT
>On 10 Ago, 17:24, Roedy Green <see_webs...@mindprod.com.invalid>
....
>But the applet is signed!

Did you reject a web start launch?  Why?

It might be the applet can be fixed, but I would need..
a) A lot more information.
b) A reason why you are not using web start for this launch.

Signature

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

Pedro Pinto - 13 Aug 2007 02:52 GMT
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

> >On 10 Ago, 17:24, Roedy Green <see_webs...@mindprod.com.invalid>
> ...
[quoted text clipped - 10 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
Andrew Thompson - 13 Aug 2007 07:02 GMT
...
>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..)
<http://www.google.com/search?as_sitesearch=java.sun.com&as_filetype=jnlp>

>...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

Signature

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



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.