Filepermisson on jar files

Discussion in 'Java' started by Pedro Pinto, Aug 10, 2007.

  1. Pedro Pinto

    Pedro Pinto Guest

    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.
    Pedro Pinto, Aug 10, 2007
    #1
    1. Advertising

  2. 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
    Andrew Thompson, Aug 10, 2007
    #2
    1. Advertising

  3. Pedro Pinto

    Pedro Pinto Guest

    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.
    Pedro Pinto, Aug 10, 2007
    #3
  4. Pedro Pinto

    Roedy Green Guest

    Re: File permisson on jar files

    >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.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Aug 10, 2007
    #4
  5. Pedro Pinto

    Guest

    On Aug 10, 10:58 am, Pedro Pinto <> 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.
    , Aug 10, 2007
    #5
  6. Pedro Pinto

    Pedro Pinto Guest

    Re: File permisson on jar files

    On 10 Ago, 17:24, Roedy Green <>
    wrote:
    > >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.
    > --
    > 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
    Pedro Pinto, Aug 10, 2007
    #6
  7. Pedro Pinto

    Pedro Pinto Guest

    On 10 Ago, 17:25, wrote:
    > On Aug 10, 10:58 am, Pedro Pinto <> 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
    Pedro Pinto, Aug 10, 2007
    #7
  8. Andrew Thompson, Aug 11, 2007
    #8
  9. Pedro Pinto

    Pedro Pinto Guest

    Re: File permisson on jar files

    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 11 Ago, 01:01, "Andrew Thompson" <u32984@uwe> wrote:
    > Pedro Pinto wrote:
    > >On 10 Ago, 17:24, Roedy Green <>

    > ...
    > >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.
    >
    > --
    > Andrew Thompsonhttp://www.athompson.info/andrew/
    >
    > Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
    Pedro Pinto, Aug 13, 2007
    #9
  10. Re: File permisson on jar files

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

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

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
    Andrew Thompson, Aug 13, 2007
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric McIntyre

    Jar files in Jar files

    Eric McIntyre, May 24, 2004, in forum: Java
    Replies:
    1
    Views:
    460
    Roedy Green
    May 24, 2004
  2. Arnold Peters
    Replies:
    0
    Views:
    552
    Arnold Peters
    Jan 5, 2005
  3. muttley
    Replies:
    0
    Views:
    2,688
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,722
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    637
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page