jar file not named .jar and "Applet .. notinited"

Discussion in 'Java' started by Antti Järvinen, Feb 9, 2008.

  1. Dear Sirs,

    there seems to be some kind of magic regarding naming of jar files
    when loading an applet via web browser. Lets say I have foo.jar
    and reference it via html this way
    <applet code="Foo.class" archive="foo.jar" width="200" height="50"></applet>
    everything works jolly well.

    If I rename "foo.jar" to plain "foo" and change my html to say
    <applet code="Foo.class" archive="foo" width="200" height="50"></applet>
    then my web browser tells me "Applet Foo notinited". This happens with java
    1.4.2 having mozilla or netscape around. Oddly enough, in mozilla, if I
    re-load the page, then the applet does get started. In netscape this does not
    help. I have here made sure that mime-type of file "foo" is right.

    Is there any other work-around than naming the jar files with .jar
    extension?

    I'm having a system where the URLs pointing to various stuff, including .jar
    files, do not have anything to do with original filenames ; I might be
    able to change that but is there any other way to make java to recognize
    jar files as jar files regardless of URL ending?

    --
    Costello the Warrior St:18/09 Dx:14 Co:18 In:8 Wi:12 Ch:7 Neutral
    Dlvl:16 $:0 HP:129(129) Pw:52(52) AC:-6 Xp:14/83896 T:19462 Satiated
     
    Antti Järvinen, Feb 9, 2008
    #1
    1. Advertising

  2. (Antti Järvinen) writes:
    > If I rename "foo.jar" to plain "foo" and change my html to say
    > <applet code="Foo.class" archive="foo" width="200" height="50"></applet>
    > then my web browser tells me "Applet Foo notinited". This happens with java


    But that gets fixed by adding a parameter
    <param name="archive" value="foo"></param>
    but then, having java 1.6 the "foo" does not get run while being
    served via https:// url, via http:// url it works. SSL-enabled httpd
    has expired certificate, this is most likely the reason? Has this
    thing changed from 1.4.2 java (where everything now works) to 1.6.0
    where this now works but not when behind a secure connection?

    --
    Costello the Warrior St:18/09 Dx:14 Co:18 In:8 Wi:12 Ch:7 Neutral
    Dlvl:16 $:0 HP:129(129) Pw:52(52) AC:-6 Xp:14/83896 T:19462 Satiated
     
    Antti Järvinen, Feb 10, 2008
    #2
    1. Advertising

  3. On Feb 10, 5:57 am, (Antti Järvinen) wrote:
    > Dear Sirs,
    >
    > there seems to be some kind of magic regarding naming of jar files
    > when loading anappletvia web browser.


    No 'magic', though Sun has not been particularly clear
    that they expect archives to end in '.jar'. A recent
    bug showed that the plug-in (for applets and web start)
    would not check security certificates for '.zip' files,
    which a lot of projects had come to use over the years.

    The plug-in could access the resources within the .zip
    just fine, its just it would not consider the code to
    be trusted.

    Use .jar extension and and forget about it, or pursue what
    'flavor of the minute' adjustments might make another file
    type work, and spend the rest of the app. time on maintenance.

    --
    Andrew T.
    PhySci.org
     
    Andrew Thompson, Feb 11, 2008
    #3
  4. Antti Järvinen

    Roedy Green Guest

    On Sat, 09 Feb 2008 21:57:25 +0200, (Antti Järvinen)
    wrote, quoted or indirectly quoted someone who said :

    >Is there any other work-around than naming the jar files with .jar
    >extension?


    That does not make any sense. Why would you expect misnamed jars to
    work? Why do you want them to?

    Consider also that your webserver sends out the correct mime type for
    jars, but not for jars renamed without the .jar extension.

    see http://mindprod.com/jgloss/mime.html

    For the scoop on the <APPLET tag, see
    http://mindprod.com/jgloss/applet.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Feb 11, 2008
    #4
  5. Roedy Green <> writes:
    > That does not make any sense. Why would you expect misnamed jars to
    > work? Why do you want them to?


    Well, concept of "file name" while being used in URL is a bit difficult,
    in this system I have in hand it is for instance possible to specify
    the version of the file, lets say I type in an URL of form
    "http://foobar.com/file.jar?version=xyz"
    where the "file.jar" may be understandable by human reader but
    most URI parsers may be a bit confuzed. Now it actually replaces the
    "name" with a number, making the url to be of form
    "http://foobar.com/fileid=123?version=456"

    > Consider also that your webserver sends out the correct mime type for
    > jars, but not for jars renamed without the .jar extension.


    Well, the mime type is correct. The jar is being served via CGI program
    that has odd-looking URL but it knows the mime type of each binary no
    problem.

    > For the scoop on the <APPLET tag, see
    > http://mindprod.com/jgloss/applet.html


    yep, thanks.

    --
    Costello the Warrior St:18/09 Dx:14 Co:18 In:8 Wi:12 Ch:7 Neutral
    Dlvl:16 $:0 HP:129(129) Pw:52(52) AC:-6 Xp:14/83896 T:19462 Satiated
     
    Antti Järvinen, Feb 12, 2008
    #5
  6. Roedy Green wrote:
    > On Sat, 09 Feb 2008 21:57:25 +0200, (Antti Järvinen)
    > wrote, quoted or indirectly quoted someone who said :
    >
    >> Is there any other work-around than naming the jar files with .jar
    >> extension?

    >
    > That does not make any sense. Why would you expect misnamed jars to
    > work? Why do you want them to?


    They ought to work because the web server supplies the correct MIME
    type. The MIME type rather than the extension ought to be the
    authoritative type of the file. As for why, some web servers can't
    easily be configured to serve .jar files. For example the web server in
    my NAS device can use PHP to deliver a jar file but the url has to have
    a .PHP extension so that a script is executed to deliver the file. The
    only other way to alter the configuration of the server to deliver .jar
    files requires voiding the warranty.

    Mark Thornton
     
    Mark Thornton, Feb 12, 2008
    #6
    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. Kristoffel

    Applet notinited

    Kristoffel, Oct 26, 2003, in forum: Java
    Replies:
    5
    Views:
    22,091
    Tor Iver Wilhelmsen
    Oct 27, 2003
  2. Arnold Peters
    Replies:
    0
    Views:
    598
    Arnold Peters
    Jan 5, 2005
  3. ted holden

    applet notinited problem

    ted holden, Jan 11, 2005, in forum: Java
    Replies:
    3
    Views:
    8,134
    Andrew Thompson
    Jan 11, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,807
    Roedy Green
    Feb 14, 2006
  5. randi
    Replies:
    0
    Views:
    537
    randi
    Nov 13, 2008
Loading...

Share This Page