exceptions that shouldn't be while trying to display a signed JApplet using the appletviewer

Discussion in 'Java' started by lbrtchx@hotmail.com, Jul 25, 2007.

  1. Guest

    I am getting
    ~
    ClassNotFoundException . . . "Caused by" . . . FileNotFoundException
    ~
    exceptions
    ~
    C:\JApps\JApplet>appletviewer -J-Djava.security.policy=test00.policy
    test00.html
    load: class WP04_Japplet00 not found.
    java.lang.ClassNotFoundException: WP04_Japplet00
    at
    sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at
    sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at
    sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
    at sun.applet.AppletPanel.run(AppletPanel.java:361)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
    \test00_signed.jar\test00.class (The system cannot find
    the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at
    sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:
    70)
    at
    sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:
    161)
    at
    sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
    at sun.applet.AppletClassLoader.access
    $100(AppletClassLoader.java:44)
    at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:
    173)
    at java.security.AccessController.doPrivileged(Native Method)
    at
    sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
    ... 8 more
    ~
    the thing is that I can see the actual file right there in the jar
    exactly where appletviewer is telling me it can not find it
    ~
    C:\JApps\JApplet>jar -tvf test00_signed.jar
    1962 Wed Jul 25 16:08:20 EDT 2007 META-INF/MANIFEST.MF
    2083 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.SF
    1095 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.DSA
    0 Wed Jul 25 16:08:20 EDT 2007 META-INF/
    828 Wed Jul 25 16:08:20 EDT 2007 AuthorCommentsBox00.class
    669 Wed Jul 25 16:08:20 EDT 2007 JControls00.class
    1956 Wed Jul 25 16:08:20 EDT 2007 LocalResource02.class
    543 Wed Jul 25 16:08:20 EDT 2007 navBar00.class
    573 Wed Jul 25 16:08:20 EDT 2007 navBarPix02.class
    323 Wed Jul 25 16:08:20 EDT 2007
    OptionsIndexOutOfBoundsException00.class
    946 Wed Jul 25 16:08:20 EDT 2007 PixSel04.class
    836 Wed Jul 25 16:08:20 EDT 2007 PixSelCtrl00.class
    661 Wed Jul 25 16:08:20 EDT 2007 PixSelName04.class
    286 Wed Jul 25 16:08:18 EDT 2007 PopUpAktnH00.class
    3200 Wed Jul 25 16:08:18 EDT 2007 PUpAktn14.class
    885 Wed Jul 25 16:08:18 EDT 2007 PUpSel00$1.class
    1100 Wed Jul 25 16:08:18 EDT 2007 PUpSel00.class
    892 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$1.class
    589 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$2.class
    2238 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00.class
    1655 Wed Jul 25 16:08:20 EDT 2007 SldSpd04.class
    738 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$1.class
    720 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$2.class
    1497 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02.class
    1023 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02$BookInfo.class
    5316 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02.class
    8212 Wed Jul 25 16:08:20 EDT 2007 WP04_JApplet00.class
    0 Tue Jul 24 17:31:28 EDT 2007 images/./
    0 Tue Jul 24 17:31:28 EDT 2007 images/./gui/
    946 Wed Feb 17 22:44:30 EST 1999 images/./gui/cut.gif
    200 Mon Sep 04 09:06:32 EDT 2006 images/./gui/warning1.gif
    0 Tue Jul 24 17:31:28 EDT 2007 images/./pix/
    42499 Sun Sep 17 23:22:54 EDT 2006 images/./pix/BidOldMonkeyHalf.jpg
    ~
    I am using windows
    ~
    C:\JApps\JApplet>java -version
    java version "1.6.0_01"
    Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
    Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
    ~
    to sign the jar file and run the appletviewer with a batch file
    ~
    SET _KD=WP04_JApplet00

    SET _SNDKD=%_KD%_signed

    SET _KSTR="keys.kstr"

    SET _STRPW="password"

    SET _DNM="CN=, OU=wwwabc, O=org, L=noplace, ST=AR, C=US"

    SET _ALIAS=""

    echo "// __ del(eting) %_KSTR%, *.jar, *.class"

    del %_KSTR%

    echo "del *.jar"
    del *.jar

    echo "del *.class"
    del *.class

    echo "// __ Compiling all classes in directory"

    javac *.java

    echo "// __ jar(ring) all classes in directory"

    jar cvf0 %_KD%.jar *.class -C "images/" .

    keytool -genkey -keystore %_KSTR% -storepass %_STRPW% -keypass %_STRPW
    % -dname %_DNM% -alias %_ALIAS%

    keytool -export -keystore %_KSTR% -storepass %_STRPW% -alias %_ALIAS% -
    file %_KD%.cer

    jarsigner -keystore %_KSTR% -storepass %_STRPW% -keypass %_STRPW% -
    signedjar %_SNDKD%.jar %_KD%.jar %_ALIAS%

    echo "del *.class"
    del *.class

    del %_KD%.jar

    appletviewer -J-Djava.security.policy=%_KD%.policy %_KD%.html
    ~
    which I have used without any problems in other cases
    ~
    What is going on there?
    ~
    Thanks
    lbrtchx
    , Jul 25, 2007
    #1
    1. Advertising

  2. Guest

    also, my java policy file looks like this:
    ~
    keystore "keys.kstr";

    grant codeBase "file:C:/JApps/JApplet/-" {
    permission java.security.AllPermission;
    };
    , Jul 25, 2007
    #2
    1. Advertising

  3. Andrew Thompson, Jul 25, 2007
    #3
  4. Nigel Wade Guest

    wrote:


    > Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
    > \test00_signed.jar\test00.class (The system cannot find
    > the path specified)


    > ~
    > the thing is that I can see the actual file right there in the jar
    > exactly where appletviewer is telling me it can not find it
    > which I have used without any problems in other cases
    > ~
    > What is going on there?


    Which file can you see? I don't see a file called test00.class in your jar,
    which is the file that the classloader says it cannot find. Maybe my eyesight
    is failing?

    --
    Nigel Wade, System Administrator, Space Plasma Physics Group,
    University of Leicester, Leicester, LE1 7RH, UK
    E-mail :
    Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
    Nigel Wade, Jul 26, 2007
    #4
  5. Twisted Guest

    On Jul 25, 4:41 pm, wrote:
    > load: class WP04_Japplet00 not found.
    > 8212 Wed Jul 25 16:08:20 EDT 2007 WP04_JApplet00.class


    Oops. It's looking for "Japplet" but the closest you have is
    "JApplet". Even if the Windoze machine you're using has a case-
    insensitive filesystem, the jar file's inner filesystem and Java are
    both case-sensitive and will see the difference. (Also, if the class
    is internally named with a capital A it would still not have worked in
    all likelihood. If it is internally named with a small a, then it
    won't work even if you change the class to load to use a capital A to
    match the jar file name. All three must match case, and with case
    insensitive filesystems, the class name on the command line or in the
    HTML code and the class name in the source file must still match case.)
    Twisted, Jul 26, 2007
    #5
  6. Roedy Green Guest

    On Wed, 25 Jul 2007 13:41:41 -0700, wrote, quoted
    or indirectly quoted someone who said :

    >WP04_Japplet00


    Where's the package? Put every class in a jar in a package. You
    invite trouble when you code in a non-idiomatic way.

    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Jul 26, 2007
    #6
  7. Guest

    Sorry
    ~
    actually the classes I was using were called WP04_Japplet00, etc,
    naming/cases were consistent
    ~
    the thing is that I trimmed down the example in order to debug it
    using "test00" as the name of file
    ~
    I am still having the problem, which I can notunderstand. Let me
    reproduce it cleanly and repost it here
    ~
    lbrtchx
    , Jul 26, 2007
    #7
  8. Roedy Green Guest

    On Thu, 26 Jul 2007 07:58:31 -0700, wrote, quoted
    or indirectly quoted someone who said :

    > actually the classes I was using were called WP04_Japplet00, etc,
    >naming/cases were consistent


    General rule. Tell the truth. When you tell fibs to simplify, you
    often mask the source of the trouble. To simplify, simplify your
    actual compilable source code, and quote the whole thing precisely.
    This process often helps you solve your own problem. See
    http://mindprod.com/jgloss/sscce.html

    When you have more than one class, organise your classes into
    packages. See http://mindprod.com/jgloss/package.html

    "." not " _" separates package name from class.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Jul 26, 2007
    #8
  9. Guest

    OK here it is
    ~
    C:\JApps\JApplet>appletviewer -J-Djava.security.policy=test00.policy
    test00.html
    load: class test00 not found.
    java.lang.ClassNotFoundException: test00
    at
    sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at
    sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at
    sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
    at sun.applet.AppletPanel.run(AppletPanel.java:361)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
    \test00_signed.jar\test00.class (The system cannot find the path
    specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileInputStream.<init>(FileInputStream.java:66)
    at
    sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:
    70)
    at
    sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection....
    161)
    at
    sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
    at sun.applet.AppletClassLoader.access
    $100(AppletClassLoader.java:44)
    at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:
    173)
    at java.security.AccessController.doPrivileged(Native Method)
    at
    sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
    ... 8 more
    ~
    the thing is that I can see the actual file right there in the jar
    exactly where appletviewer is telling me it can not find it
    ~
    C:\JApps\JApplet>jar -tvf test00_signed.jar
    1962 Wed Jul 25 16:08:20 EDT 2007 META-INF/MANIFEST.MF
    2083 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.SF
    1095 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.DSA
    0 Wed Jul 25 16:08:20 EDT 2007 META-INF/
    828 Wed Jul 25 16:08:20 EDT 2007 AuthorCommentsBox00.class
    669 Wed Jul 25 16:08:20 EDT 2007 JControls00.class
    1956 Wed Jul 25 16:08:20 EDT 2007 LocalResource02.class
    543 Wed Jul 25 16:08:20 EDT 2007 navBar00.class
    573 Wed Jul 25 16:08:20 EDT 2007 navBarPix02.class
    323 Wed Jul 25 16:08:20 EDT 2007
    OptionsIndexOutOfBoundsException00.class
    946 Wed Jul 25 16:08:20 EDT 2007 PixSel04.class
    836 Wed Jul 25 16:08:20 EDT 2007 PixSelCtrl00.class
    661 Wed Jul 25 16:08:20 EDT 2007 PixSelName04.class
    286 Wed Jul 25 16:08:18 EDT 2007 PopUpAktnH00.class
    3200 Wed Jul 25 16:08:18 EDT 2007 PUpAktn14.class
    885 Wed Jul 25 16:08:18 EDT 2007 PUpSel00$1.class
    1100 Wed Jul 25 16:08:18 EDT 2007 PUpSel00.class
    892 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$1.class
    589 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$2.class
    2238 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00.class
    1655 Wed Jul 25 16:08:20 EDT 2007 SldSpd04.class
    738 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$1.class
    720 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$2.class
    1497 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02.class
    1023 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02$BookInfo.class
    5316 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02.class
    8212 Wed Jul 25 16:08:20 EDT 2007 test00.class
    0 Tue Jul 24 17:31:28 EDT 2007 images/./
    0 Tue Jul 24 17:31:28 EDT 2007 images/./gui/
    946 Wed Feb 17 22:44:30 EST 1999 images/./gui/cut.gif
    200 Mon Sep 04 09:06:32 EDT 2006 images/./gui/warning1.gif
    0 Tue Jul 24 17:31:28 EDT 2007 images/./pix/
    42499 Sun Sep 17 23:22:54 EDT 2006 images/./pix/BidOldMonkeyHalf.jpg
    ~
    I am using windows
    ~
    C:\JApps\JApplet>java -version
    java version "1.6.0_01"
    Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
    Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
    ~
    to sign the jar file and run the appletviewer with a batch file
    ~
    SET _KD=test00

    SET _SNDKD=%_KD%_signed


    SET _KSTR="keys.kstr"


    SET _STRPW="password"


    SET _DNM=", OU=wwwabc, O=org, L=noplace, ST=AR, C=US"


    SET _ALIAS=""


    echo "// __ del(eting) %_KSTR%, *.jar, *.class"


    del %_KSTR%


    echo "del *.jar"
    del *.jar


    echo "del *.class"
    del *.class


    echo "// __ Compiling all classes in directory"


    javac *.java


    echo "// __ jar(ring) all classes in directory"


    jar cvf0 %_KD%.jar *.class -C "images/" .


    keytool -genkey -keystore %_KSTR% -storepass %_STRPW% -keypass
    %_STRPW
    % -dname %_DNM% -alias %_ALIAS%


    keytool -export -keystore %_KSTR% -storepass %_STRPW% -alias %_ALIAS%
    -
    file %_KD%.cer


    jarsigner -keystore %_KSTR% -storepass %_STRPW% -keypass %_STRPW% -
    signedjar %_SNDKD%.jar %_KD%.jar %_ALIAS%


    echo "del *.class"
    del *.class


    del %_KD%.jar

    appletviewer -J-Djava.security.policy=%_KD%.policy %_KD%.html
    ~
    also, my java policy file looks like this:
    ~
    keystore "keys.kstr";

    grant codeBase "file:C:/JApps/JApplet/-" {
    permission java.security.AllPermission;
    }
    ~
    Thanks
    lbrtchx
    , Jul 26, 2007
    #9
  10. Guest

    Oops! No mistery whatsoever, a typo crept in ...
    ~
    lbrtchx
    , Jul 26, 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. Joe Van Dyk
    Replies:
    4
    Views:
    325
    Joe Van Dyk
    Apr 10, 2006
  2. john_c
    Replies:
    6
    Views:
    570
    John Saunders
    Mar 11, 2007
  3. kyrpa83
    Replies:
    1
    Views:
    616
    kyrpa83
    Oct 17, 2007
  4. Qu0ll
    Replies:
    17
    Views:
    2,075
    Andrew Thompson
    Jun 29, 2008
  5. Andrew Walrond
    Replies:
    6
    Views:
    94
    Ara.T.Howard
    Jun 29, 2004
Loading...

Share This Page